Wednesday, December 14, 2011

How to restore locally deleted file in git

If you have not committed yet then find the last commit 
git rev-list -n 1 HEAD -- <file_path> 

Then checkout the version at the commit before.
git checkout <deleting_commit>^ -- <file_path>

How to see list of tags for a git repo

To see list of all tags for a git repo, run command
git tag

To also see the commit message along with the tag, run command
git tag -n

How to push tags in your local git repo to remote

Following command pushes all tags from local git repo to remote
git push --tags