Git 是基于 Linux 内核开发的版本控制工具。与常用的版本控制工具 CVS,Subversion 等不同,它采用了分布式版本库的方式,不必服务器端软件支持,使源代码的发布和交流极其方便。 Git 的速度很快,这对于诸如 Linux kernel 这样的大项目来说自然很重要。 Git 最为出色的是它的分支、合并、跟踪的能力。
$ ls -al ~/.ssh
# Lists the files in your .ssh directory, if they exist
$ ssh-keygen -t rsa -C "your_email@example.com" # Creates a new ssh key, using the provided email as a label # Generating public/private rsa key pair. # Enter file in which to save the key (/c/Users/you/.ssh/id_rsa): [Press enter]
Your identification has been saved in /c/Users/you/.ssh/id_rsa. # Your public key has been saved in /c/Users/you/.ssh/id_rsa.pub. # The key fingerprint is: # 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com
# start the ssh-agent in the background $ ssh-agent -s # Agent pid 59566 $ ssh-add ~/.ssh/id_rsa
$ clip < ~/.ssh/id_rsa.pub # Copies the contents of the id_rsa.pub file to your clipboard
$ mkdir lmlphp $ cd lmlphp $ git init
C:\Users\May\Documents\GitHub\test> git clone git@github.com:leiminglin/LMLPHP.g it Cloning into ‘LMLPHP‘... Warning: Permanently added ‘github.com,192.30.252.128‘ (RSA) to the list of know n hosts. remote: Counting objects: 210, done. remote: Total 210 (delta 0), reused 0 (delta 0) Receiving objects: 100% (210/210), 66.48 KiB | 15.00 KiB/s, done. Resolving deltas: 100% (102/102), done. Checking connectivity... done. C:\Users\May\Documents\GitHub\test>
C:\Users\May\Documents\GitHub\test> cd .\LMLPHP C:\Users\May\Documents\GitHub\test\LMLPHP [master]> git branch -av * master 405960a session_write_close() when fatal error occured remotes/origin/HEAD -> origin/master remotes/origin/develop 405960a session_write_close() when fatal error occured remotes/origin/master 405960a session_write_close() when fatal error occured C:\Users\May\Documents\GitHub\test\LMLPHP [master]> git branch develop C:\Users\May\Documents\GitHub\test\LMLPHP [master]> git branch -av develop 405960a session_write_close() when fatal error occured * master 405960a session_write_close() when fatal error occured remotes/origin/HEAD -> origin/master remotes/origin/develop 405960a session_write_close() when fatal error occured remotes/origin/master 405960a session_write_close() when fatal error occured C:\Users\May\Documents\GitHub\test\LMLPHP [master]>
C:\Users\May\Documents\GitHub\test\LMLPHP [master]> git checkout develop Switched to branch ‘develop‘ C:\Users\May\Documents\GitHub\test\LMLPHP [develop]> git branch -av * develop 405960a session_write_close() when fatal error occured master 405960a session_write_close() when fatal error occured remotes/origin/HEAD -> origin/master remotes/origin/develop 405960a session_write_close() when fatal error occured remotes/origin/master 405960a session_write_close() when fatal error occured C:\Users\May\Documents\GitHub\test\LMLPHP [develop]> git checkout -b newFeature Switched to a new branch ‘newFeature‘ C:\Users\May\Documents\GitHub\test\LMLPHP [newFeature]> git branch -av develop 405960a session_write_close() when fatal error occured master 405960a session_write_close() when fatal error occured * newFeature 405960a session_write_close() when fatal error occured remotes/origin/HEAD -> origin/master remotes/origin/develop 405960a session_write_close() when fatal error occured remotes/origin/master 405960a session_write_close() when fatal error occured C:\Users\May\Documents\GitHub\test\LMLPHP [newFeature]>
C:\Users\May\Documents\GitHub\test\LMLPHP [newFeature]> git status On branch newFeature nothing to commit, working directory clean
C:\Users\May\Documents\GitHub\test\LMLPHP [newFeature]> git pull Warning: Permanently added ‘github.com,192.30.252.130‘ (RSA) to the list of know n hosts. There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details git pull If you wish to set tracking information for this branch you can do so with: git branch --set-upstream-to=origin/ newFeature C:\Users\May\Documents\GitHub\test\LMLPHP [newFeature]> git pull origin develop Warning: Permanently added ‘github.com,192.30.252.130‘ (RSA) to the list of know n hosts. From github.com:leiminglin/LMLPHP * branch develop -> FETCH_HEAD Already up-to-date. C:\Users\May\Documents\GitHub\test\LMLPHP [newFeature]>
C:\Users\May\Documents\GitHub\test\LMLPHP [newFeature]> git commit -m "test" On branch newFeature nothing to commit, working directory clean
C:\Users\May\Documents\GitHub\test\LMLPHP [newFeature]> git push fatal: The current branch newFeature has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin newFeature C:\Users\May\Documents\GitHub\test\LMLPHP [newFeature]> git push --set-upstream origin develop Warning: Permanently added ‘github.com,192.30.252.130‘ (RSA) to the list of know n hosts. Branch develop set up to track remote branch develop from origin. Everything up-to-date
git log
命令查看。
原文地址:http://blog.csdn.net/angjunqiang/article/details/46043597