Committing Your Changes Now if we want to rename the file from first.c to Sixth.c$ git mv first.c to sixth.c and we don't want this file(deleted from disk)$ git rm sixth.c Or you just want to untracked file not deleted from disk$ git rm --cached second.c $ git commit -m 'delete sixth.c & third comm'after we commit and realize one forgotten file should be added , so we need to go back to last commit$ git forgotton_file add$ git commit --amend You can change your commit message here type $ git log and you'll see commit message changed How about staged files ? If you want to unstage.Now we modify third.c and staged it. $ git reset HEAD third.c You did some changes with third.c ,but you want to unmodified it, No problem,type this command below.$ git checkout -- third.cYou'll see "Changed but not updated" has be gone. Maybe you'll have this question , what have you changed but not staged yet ?First we modify fifth.c & README ,and staged fifth.cYou'll see this below. type $ git diff You see the changes in unstaged file README type $ git diff --cached You see the changes in staged file fifth.c Finally, you can use the friendly GUI to know what have we done.$ gitk Tagging We can use tags after your commit to specific points in history Now let's creating tags.$ git tag -a v1.1 -m 'My Version V1.1' # -a tag name ; -m tag messageand shows the tagger detail information$ git show v1.1 If you want to tag the commit of history,what can we do ?$ git log --pretty=oneline and we want to tag babf75 this commit$ git tag -a v1.3 babf75$ git show v1.3 Now let's see what tags did we make ?$ git tag Branch Create a new branch$ git branch develope or git checkout -b develope #Create & checkout See what branch do you have $ git branch the star means which branch are you working on now Svn & Git What Difference Between SVN & GitHow to make SVN & Git Together Remote Server &Email Notification File ://Http://Email Notification Merge Assume we committed on develope branch,now we have to merge it into master.$ git checkout master$ git merge develope Delete the branch$ git branch -d develope # if you want to delete the branch that you have not merge it, you should use -D ConflicatsYou have solve this problem by yourself,use commands below to help you do it. $ git branch - v #You can see the last commit on each branch$ git branch --merged$ git branch --no-merged #To see all branches which is merged or not on the branch that you work on. Rebasing you can take all the changes that were committed on one branch and replay them on another one. $ git checkout experiment$ git rebase master Do not rebase commits that you have pushed to a public repository, or every body 'll hate you. Add Remote Server Local Protocol (cc) image by anemoneprojectors on Flickr This command will copy all remote_repository to your disk.$ git clone /your/path/or you just want to add exsiting repository.$ git remote add [name] /your/path The Http Protocol What Difference Between Git & SVN Git sVN Distributed Centralized Log on local Log on web $ cd /var/www/htdocs/$ git clone --bare /home/rubyho/server3 httpserver3.git$ cd httpserver3.git$ mv hooks/post-update.sample hooks/post-update$ chmod a+x hooks/post-update Email Notification 1. /usr/share/doc/git-core/contrib/hooks/2.$ chmod a+x post-receive-email3.$ ln -sf /usr/share/doc/git-core/contrib/hooks/post/receive-email/ your-project's path.git/hooks/post-receive4. cd your project's path.git/hook/5.$ chmod a+x post-receive6. cd ..7.$ git config --add hooks.mailinglist "Email"8.$ vim config #will show what are you setting9.$ git config hooks.emailprefix [project name]10.cd description11. vim description #set detail of mail Share With Everyone When you are ready to share your code with everyone.$ git push [remote_name][branch-name]when you would like to know $ git pullThe command goes out to that remote project and pulls down all the data from that remote project that you don’thave yet.$ git fetch [remote-name]It'll show you about remote repository information$ git remote show [remote-name]If you want to remove the remote repository$ git remote rm [remote-name] If you have remote repository,you can use these command to update with remote repository. Less storage Space How To Make Git & Svn Together 1.install git-svn$ sudo apt-get install git-svn2.Assume I already have my own svn repository,and now you want to join it.$ git svn clone --stdlayoutfile:///tmp/test/hello hello-git Due to use stdlayout ,so that tag/branch will be automatic correspond to remote branch You find out that my Program can't compile,so you begin to edit file,after edited,you use $ git add -p command to pick up which part of repository will be commit and the others will be stash,final, use $ git svn dcommit commit to my svn repository Few days later,I find out that you has updated,so I need to do synchronous,at the same time,I have a local branch master, after I update branch master,Ineed to make fancy branch and master rebase. $ git svn fetch M hello.cr6 = c43134a98f43dc6507deaa7495bfcd2c906aaa30 (trunk)$ git svn rebaseFirst, rewinding head to replay your work on top of it...Fast-forwarded master to refs/remotes/trunk.$ git checkout fancy$ git rebase masterFirst, rewinding head to replay your work on top of it...Applying: Inital fancy output branch The End Screw Things upRevert Files BackCompare ChangesDevelope New Feature More Storage Space Follow these steps