Categories
Tech

Remove Directory from Git Repository

I recently started working with the integrated Version Control System (VCS) features of PyCharm and accidentally pushed my IDE / PyCharm project settings to my Google Code hosted Git repository. Basically, all of the files in the .idea folder of my project were pushed to the repository. While these files didn’t necessarily contain any proprietary or confidential information, I didn’t want them cluttering up my project repository. And while I could have simply removed the files and performed a commit, these files would have then been in the history of my repository.

I did some quick research and found a post on GitHub explaining how to remove a file along with its history from a GitHub repository. This command basically did what I needed to, but was designed to remove a single file at a time. Being that I wanted to remove a whole directory of files, I modified the command to remove the folder and recursively iterate through the directory removing children:

git filter-branch --force --index-filter \
'git rm -r --cached --ignore-unmatch .idea' \
--prune-empty --tag-name-filter cat -- --all

git push origin master --force

It should be noted that the command will overwrite existing tags and that if you had sensitive information in the files (like passwords), you should consider the information compromised and take appropriate action.

Categories
Tech

Sharepoint Maintenance Mode

I always forget how to get into maintenance mode on Sharepoint pages to close / remove webparts that are (potentially) causing issues. Sometimes you will even get an error message that provides a link to the maintenance mode pages. There is also some convoluted way of getting into maintenance mode, but I can never remember it.

An easy way to get into maintenance mode is to simply add ?contents=1 to the URL. For example, if your URL was http://sharepointsite.com/pages/default.aspx you would go to http://sharepointsite.com/pages/default.aspx?contents=1