一。git使用:
1 提交到git暂存区: git add xxx.py
2 提交到git仓库: git commit -m 'this is a mark'
3 查看修改状态: git status
4 git暂存区回滚到工作区: git checkout xxx.py
5 查看历史记录: git log
6 查看历史提交记录,只看md5和提交mark: git log --pretty=oneline
mayn@DESKTOP-L7PRRDN MINGW64 /d/git_test (master)
$ git log --pretty=oneline
f30e35dd53e39b4e19d15c73a4a5d4f0c7497001 (HEAD -> master) fourth commit
0df924a788a2a02b27299989e41741581250a3ee third commit
160fd49c9df4b75821269bf12572ff8f47a58539 my first git program
7 回滚前一个版本:git reset --hard head^
8 通过版本号回滚: git reset --hard f30e35dd53
f30e35dd53:代表版本号前面一些数字,至少前六位
9 查看所有操作记录,回滚及提交记录:git relog
mayn@DESKTOP-L7PRRDN MINGW64 /d/git_test (master)
$ git reflog
f30e35d (HEAD -> master) HEAD@{0}: reset: moving to f30e35dd53
4890e1f HEAD@{1}: commit: commit 5
0df924a HEAD@{2}: reset: moving to HEAD^
f30e35d (HEAD -> master) HEAD@{3}: reset: moving to f30e35dd53
0df924a HEAD@{4}: reset: moving to HEAD^
f30e35d (HEAD -> master) HEAD@{5}: commit: fourth commit
0df924a HEAD@{6}: commit: third commit
160fd49 HEAD@{7}: commit (initial): my first git program
10. 创建分支 git checkout -b xxxx
查看分支 git branch
[root@localhost git_test]# git checkout -b dev
Switched to a new branch 'dev'
[root@localhost git_test]# git branch
* dev
master
11 head指针切换到master : git checkout master
12 head指针切换到分支xxx: git checkout xxx
*******下面操作涉及到上传到git hub仓库,需要先注册git hub账号,具体看下边第二部分**************
13 上传到分支 git push origin xxx
[root@