git命令备忘

git config --global credential.helper store
git checkout -b 本地分支名x origin/远程分支名x
git fetch origin 远程分支名x:本地分支名x
git checkout master //切换分支
git stash 
git fetch
git pull
git reset --hard <版本号> // 注意使用 --hard 参数会抛弃当前工作区的修改
git reset --sort // 使用 --soft 参数的话会回退到之前的版本,但是保留当前工作区的修改,可以重新提交
git push origin <分支名> --force // 强制push
git commit --amend // 修改注释

git fetch -p 更新远程分支,包括删除

git push -u origin master

==============================================

git 撤销push 

git reset --hard 版本号

git push origin <分支名> --force

==============================================

git 复制分支到新的分支

git cherry-pick commitId,如果有冲突 git cherry-pick --continue,git push

----------------------------------------------------------------------------------------------------------------------------------------------

git 撤销push
https://blog.csdn.net/xs20691718/article/details/51901161
https://blog.csdn.net/guozhaohui628/article/details/78922946

git 复制分支到新的分支 https://blog.csdn.net/shiki_41/article/details/80352029

----------------------------------------------------------------------------------------------------------------------------------------------

Perhaps you should specify a branch such as 'master'.

git push origin master

git branch --set-upstream-to=origin/master

git branch --set-upstream-to=xxx/develop master

----------------------------------------------------------------------------------------------------------------------------------------------

git如何合并远程2个分支 https://blog.csdn.net/tmacsky/article/details/78795894

git push -f https://www.jianshu.com/p/b03bb5f75250 

原文地址:https://www.cnblogs.com/cdfive2018/p/9164684.html