git and svn
Lately I am trying to get hold of version control tool git. I have worked with svn but git has whole of other options and believe me it is not so bad as your first impression if you are an svn user. First Impression is not the last impression, always. Actually this is not the first, as we need to unlearn certain things which sometimes makes it tough. Got hold of the below link in case you use both, like me and often get confuse with the syntax.
http://git.or.cz/course/svn.html
- Download git on windows from http://code.google.com/p/msysgit/downloads/
- Use git
- Ssh-keygen –t rsa –C hello@gmail.com
- git config --global user.email hello@gmail.com
- git config --global user.name “Hi Hello“
- git config --global github.user hi-hello
- git config --global github.token 0987654321yourf0123456789
Migrate from svn to git
Do a SVN Export of the repository you want to migrate to GIT.
• Goto the Directory
• git init
• git add .
• git commit –m ‘Migration from SVN to GIT’
• git remote add origin git@repository_location.com
• git push origin master
Git Stash
Very often while committing or pushing or pulling our changes in/from remote repository, we get the error message, like "you have local changes, please stash your changes or remove them before pushing". Now that means the local changes are nor allowing them to pull the things (sometimes wither you will have a conflict which you can edit later ) or the stash them. Now what does 'stash' means in git, same as the dictionary meaning To hide or store away in a secret place.
Commands
• git stash save “your message for the stash” --> This command will save your changes away to the
stash
, and reset your working tree and the index to match the tip of your current branch.• git stash list --> you can see which stashes you have saved
• git stash pop --> you like to pop out the last stash, similar to pop out an element from a linked-list.
• git stash apply stash@{0} -->you can go back to what you were working on with
git stash apply
: stash@{0} part? That's your stash ID. The stash ID changes with every stash you make. stash@{0} refers to the last stash you made.• git stash show -p | git apply –reverse
•
• git stash clear --> you like to clear out all the stashes.
References:
For using git with Windows this link is really useful :
http://nathanj.github.com/gitguide/tour.html
enjoy !!
Comments