-
将远程指定分支拉取到本地指定分支
git pull origin <远程分支名>:<本地分支名>
-
将远程指定分支 拉取到 本地当前分支上
git pull origin <远程分支名>
-
将与本地当前分支同名的远程分支 拉取到 本地当前分支上(需先关联远程分支)
git pull origin
-
git修改默认编辑器
git默认的编辑器为nano,不常用,需要修改为vim,方法如下: 打开.git/config文件,在core中添加 editor=vim即可。 或者运行命令 git config –global core.editor vim 修改更加方便。
-
git提交commit
git commit -a
-
git恢复修改文件
git checkout -- aaa.txt # aaa.txt为文件名
-
git切换新分支
git checkout -b 新分支名
-
更新分支代码并提交
git add * git commit -m " " git push origin 新分支名
-
git推上服务器跟踪
git push --set-upstream origin issue-fix-51
-
查看远程分支
git branch -r
-
查看本地分支
git branch
-
拉取远程分支
git checkout -b 本地分支 origin/远程分支
-
本地冲突,先删除本地分支,再重新拉取远程分支
git branch -D 本地分支名称
-
add 添加错文件 撤销
git add . git reset HEAD
-
代码暂存
git stash