Git获取远程分支
可以将远程分支信息获取到本地
下载远程仓库的所有变动
$ git fetch [remote]
切换到指定分支,并更新工作区
$ git checkout [branch-name]
远程分支映射到本地命名为local-branchname 的一分支
git checkout -b local-branchname origin/remote_branchname
新建一个分支,与指定的远程分支建立追踪关系
$ git branch –track [branch] [remote-branch]
建立追踪关系,在现有分支与指定的远程分支之间
$ git branch –set-upstream [branch] [remote-branch]
合并指定分支到当前分支
$ git merge [branch]
Git提交
提交暂存区到仓库区
$ git commit -m [message]
提交工作区自上次commit之后的变化,直接到仓库区
$ git commit -a
$ git commit -a -m [message]
push提交到远程仓库
$ git push origin HEAD:feature/20170614_947726_atkf_1
Git撤销
恢复暂存区的指定文件到工作区
$ git checkout [file]
恢复某个commit的指定文件到暂存区和工作区
$ git checkout [commit] [file]
恢复暂存区的所有文件到工作区
$ git checkout