I made a tracking-branch
on dev-26
branch (see below), using SourceTree, from my organization's Bitbucket account. Here's how roughly my local and remote repositories look like:
$ git branch
master
* dev-26
$ git branch -r
origin/HEAD
origin/master
origin/dev-1
origin/dev-2
origin/dev-26
I committed changes on Friday 6/17 on my local dev-26
branch. Since then, I've done git pull
several times to fetch
and merge
changes from origin/dev-26
onto my local dev-26
branch. However, I've never pushed my changes.
For some reason, when I do git status
, I get the following message:
On branch dev-26
Your branch and 'origin/dev-26' have diverged,
and have 1053 and 295 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
nothing to commit, working directory clean
Subsequently, when I do git pull
, I get a lot of conflict error messages. At this point, I'm lost and just want to discard whatever changes I made on Friday 6/17 and pull whatever is currently on origin/dev-26
So, I did git reset --hard
on the last commit on Thursday 6/16 and hoping when I do git pull
, it will sync up my local dev-26
branch with origin/dev26
branch. However, I kept getting the same message (regardless how far back I reset my branch to):
On branch dev-26
Your branch and 'origin/dev-26' have diverged,
and have 1053 and 295 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
nothing to commit, working directory clean
I think I might have screwed up somewhere. Can somebody help me debug/ explain what's going on and/or find an answer to discard changes I made on Friday 6/17 and just sync my local dev-26
with origin/dev-26
?
您可以使用以下命令来避免这种情况。
git reset --hard origin/dev-26
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.