git remote add origin http://git.xxxxx.git
git add .
git commit -m "提交的啥,描述一下"
git push -u origin master
$ git push origin master
To https://github.com/xxxxx.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to ‘https://github.com/xxxxx.git‘
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: ‘git pull ...‘) before pushing again.
hint: See the ‘Note about fast-forwards‘ in ‘git push --help‘ for details.
首先:
git pull origin master --allow-unrelated-histories
然后建议做完上一步之后再重新:
git add .
git commit -m ‘提交的啥,描述一下‘
git push origin master
git reflog
git reset --hard HEAD@{n}
1、git log 查看提交记录
2、git reset --soft <版本号>
重置至指定版本的提交
可通过git log再次查看提交记录,确认是否撤回
注:git reset --soft <版本号>命令只会退回本地提交记录,远程此时还未撤回
3、git push <remotename> <commit SHA>:<remotebranchname> --force
将指定commit记录push至远程,完成撤回远程push记录
1.创建新tag 1.0.1
git tag -a 1.0.1 -m "发布1.0.1版本"
2.提到远程
git push origin 1.0.1
3.删除本地tag
git tag -d 1.0.1
4.删除tag提到远程
git push origin :refs/tags/1.0.1
再遇到继续补充....
原文:https://www.cnblogs.com/huijihuijidahuiji/p/14870530.html