报错如下:
hint: Updates were rejected because the remote contains work that you do
git did not exit cleanly (exit code 128)
error: failed to push some refs to 'https://github.com/drunkprogrammer/CDA.git'
使用网上搜索的方法:
$ git push -u origin master
$ git pull --rebase origin master
继续报错如下:
error: cannot pull with rebase: You have unstaged change
继续使用网上搜索的方法:
$ git status
$ git branch --unset-upstreamgit
$ git checkout --<file name> / $ git reset --hard
$ git stash pop
$ git branch --unset-upstreamgit
$ git checkout --<file name> / $ git reset --hard
$ git stash pop
//你的变化会被重新申请
$ git push --set-upstream origin master
$ git push -u origin master
$ git push --set-upstream origin master
$ git push -u origin master
pull报错:
$ git pull https://github.com/drunkprogrammer/CDA.git master
Auto-merging Rotated Digits/solution.txt
Conflict(content): Merge Confict in Rotated Digits/solution.txt
Automatic merge failed : fix conflicts an d then commit the result
解决方法:
$ git mergetool
打开解决冲突的工具:tortoiseGitmerge会打开their file ,mine file 和merged file.
解决完点保存。
$ git commit
包含分支的提交,切换到master分支
$git push -u origin master
push到远程仓库,同时设置跟踪分支,
下次push的时候,直接输入git push就醒了,
系统会自动用本地master分支跟踪远程master分支