create new repository
$ git init
$ git branch branch_name
可以先add,再一起commit
$ git add --all 或 $ git add .
$ git commit -m "提交内容注释"
1.使用rebase 改动历史记录
2.先把commit用git reset删除,整理完成后再重新commit
3.--amend参数修改最后的commit
$ git commit --amend -m "新注释"
$ git check out branch_name
pull:下载更新到本地
fetch:抓取内容
merge:更新本机进度(合并)
pull = fetch + merge
pull + rebase
$ git pull --rebase
这样做的好处是在多人开发时,大家都在自己的分支commit,常常会出现为了合并而生成额外的commit,如果不想要额外的commit,可以考虑用rebase方式进行合并。
在sourceTree的pull中,可以选择"Rebase instead of merge"
push到远程分支