Archive for 'Git'
Git show files for a commit
Posted on June 16, 2010, under Git.
Git Stash
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
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
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:
git ls-files -d
This will list the deleted file and lets restore it now.
git ls-files -d | xargs git checkout --
Hope this helps somebody.
Cheers!
Multiple Unfuddle Accounts
I was having my own free unfuddle account and my work also had another unfuddle account. Now I had configured my public key for my work account and when I updated the same public key for my personal account, it didn’t accept it.
It throwed a error already this key is in use.
So, what the hell do I have to do? Here’s what I did to solve it….Simple steps though
STEP 1: Create another public key
ssh-keygen -t rsa -f personal_unfuddle
As you know it will generate a key and store it file name “personal_unfuddle” -f parameter is a optional parameter and it will store it in that file.
Now you have to view the generated file to update the public key in the unfuddle
cat personal_unfuddle.pub
Copy paste the key into your unfuddle account.
STEP 2: Identifying the Key pair for the multiple account.
Create/Edit a file named “config” in youe .ssh folder
sudo vim config
Paste the following code into the config file
Host work.unfuddle.com User git IdentityFile ~/.ssh/id_rsa Host personal.unfuddle.com User git IdentityFile ~/.ssh/personal_unfuddle
After few mins, this should start working.
Hope this helps someone
Delete .svn files from a local repository
# the following command will list all the .svn files
find ./ -name .svn
# the following command will list the SVN files and delete it
find ./ -name ?.svn? -exec rm -rf {} \;