仓库初始化
git init
仓库当前状态
git status
D:\Code\gitLearn\gitTest>git status
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: 1.txt
new file: hello.py
忽略仓库文件夹中某些文件
.gitignore
记录修改文件
git add -A
git add *.py
从origin主分支拉取最新内容
git pull origin master
commit修改内容
git commit -m "New commit"
创建新分支
git branch [new branch name]
切换分支
git checkout [branch name]
push新创建分支
git push -u origin [branch name]
merge分支
git merge [branch name]
列出所有分支
git branch -a
列出所有分支
git branch
列出已经merge的分支
git branch --merged
reflog
git reflog
保存曾经某一快照的内容
git checkout [snapshot log hashcode] ----> git branch [branch name to save the previous snapshot]
回滚某一次提交
git revert [the lastest snapshot hashcode]
删除untracked的文件夹和文件
git clean -df