git clone [url]
获取一个 url 对应的远程 git repo, 并在本地创建一个 local copy
git status
查询 repo 的状态
git status -s
-s 表示shortgit touch
新建一个文件
git touch Readme.md
新建一个名为 Readme.md 的文件git vim
使用 vim 编辑器打开文件
git add
在提交之前,将新的改动添加到git 的暂存区,(staging area)。
git commit
将 add 到 staging area 中的改动提交。
gitk --all
查看所有 branch 的历史纪录。 (上面 all 前面是两个减号 “ - ”)
git push <remote> <branch>
将 <branch> push 到 <remote>。如果 <branch> 不存在则新建该 <branch>。
git remote
用于管理 git 为每一个 remote repo 的 url 建立的别名(alias)。
git remote -v
列出所有 remote aliases
git branch
列出 repo 中所有的 branch
git branch <branch>
创建名为 <branch> 的新的 branch
git checkout -b <branch>
新建一个名为 <branch> 并checkout(查看?)。如果要check out 已经存在的 branch,就把中间的 “ -b " 去掉。
git log
以默认形式显示所有commit history(提交记录?)。
git push <remote> <branch>
push your new branches and data to a remote repository.
git diff
show diff (differences) of unstaged changes.
比较工作目录中文件和 staging area 之间的差异。修改后还没有 staged 的变化。
git merge
将一个 branch merge进当前的 branch
merge -about
git checkout -b
git branch -d
git echo "somefile.file" >> gitignore
git reset "somefile.file"
git reset HEAD~
~~
~~~
~3
还是实践后加深理解吧。
a git cheat sheet might be helpful for a beginner.
click git cheat sheet to get it and enjoy it.