Archive for 'GIT'

Git Stash

Posted on March 10, 2009, under GIT.

Currently, I am working on few files and when you do a git pull, you may sometimes get a message as follows:

error: Entry 'app/views/alerts/index.rhtml' not uptodate. Cannot merge.

So you know, somebody has updated the code and you do need to commit the file so that the file can be merged and for some reason I don’t want to commit till i finish the work. This is where git stash comes into play. from your root of the app, do the following command

1
2
3
git stash 
git pull
git stash apply #Apply your changes

for more info http://www.kernel.org/pub/software/scm/git/docs/git-stash.html

Restore the deleted files with GIT

Posted on February 19, 2009, under GIT.

Today, it was a shock, that I have deleted few files without my knowledge. Fortunately, before deleting I had committed the files and so no much of tension. You can use the following commands to restore it.

View the list of deleted files:

1
git ls-files -d

This will list the deleted file and lets restore it now.

1
git ls-files -d | xargs git checkout --

Hope this helps somebody.

Cheers!