당신은 git push --force origin branchname
을 할 수 있지만 분기가 공유되고있는 경우는 아마 최선의 해결책이 아닙니다.
다음번에는 git reset --hard
을 수행하는 대신 내역을 변경해야합니다. 그렇지 않으면 커밋을 적용하여 원하는 작업을 취소해야합니다.
다행히도 git은 미친 짓이며 현재 가지고있는 것과 함께이 문제를 해결할 수 있습니다.
git branch good_tree # save a branch with your recent commits
git reset --hard last_good # reset working tree to fix pushed problem
git fetch --all # update local repo with remote changes
git reset origin/master # move pointer to where remote repo's master is
# without changing working tree from last_good
git add; git commit; git push # commit fixed stuff
git checkout good_tree # rebase your changes from last_good
git rebase master # tack good_tree onto master from undone changes
git checkout master # go back to master
git merge good_tree # now you are back to where you want to be
git push # and you can push
... 틱 - 당신은 충돌이있을 수 있습니다 : - (그것은 master
를 호출 할 수 있습니다 당신은 결국 밀어 신경 분기부터 시작)
는이 같이 보입니다 수행합니다.
강제로 밀어 넣을 수 있지만 별도의 지점에서 원격 작업을 저장하는 것이 좋습니다 ... git push origin -f master –
['git push --force'] (https : // www. kernel.org/pub/software/scm/git/docs/git-push.html). 그것으로 아주 조심하십시오. – adrianbanks