How to clear "This branch is N commits ahead of master"?

I have a branch that shows no difference from master, but its being reported as This branch is 28 commits ahead of master". I tried to clear it with the following, but it did not work. After the process, it remains in the same state.

--squash is used in an attempt to keep accurate log of events. Nothing that happens on the dev-branch arm-neon affects master until after its merged. We cannot have inaccurate logs, and its a hard requirement.

How do I clear the This branch is 28 commits ahead of master" message?


$ git checkout master
Already on 'master'
Your branch is up-to-date with 'origin/master'.

$ git diff master arm-neon
$

$ git merge arm-neon --squash -m "Synch branch 'arm-neon' with 'master'. Version control is showing arm-neon 28 commits ahead even though there are no differences"
Updating 7319206..9c8ee31
Fast-forward (no commit created; -m option ignored)
Squash commit -- not updating HEAD

$ git commit -am "Synch branch 'arm-neon' with 'master'. Version control is showing arm-neon 28 commits ahead even though there are no differences"
On branch master
Your branch is up-to-date with 'origin/master'.

$ git push
Everything up-to-date
$ git push --force
Everything up-to-date

Not a duplicate. The cited question's problem states:

1- change files
2- commit
3- repeat 1-2 until satisfied
4- push to master

We have no differences.

Another answer states to git fetch -p . I have this in a bash script and it runs regularly because its impossible to get Git to update everything with one simple command, and its impossible to get Git to delete branches with one simple command:

if [ -d "$HOME/cryptopp" ]; then
    (
    cd "$HOME/cryptopp"
    git fetch -p && for branch in `git branch -vv | grep ": gone]" | $AWK '{print $1}'`; do git branch -D $branch; done
    ) </dev/null &>/dev/null &
    disown $!
fi

Yet another answer states to git pull --rebase . I believe that's incompatible with --squash . But if that's the answer, then someone needs to state it. It gets old experimenting with "maybe this will work, maybe that will work" answers.

链接地址: http://www.djcxy.com/p/23160.html

上一篇: Git:由X提交提前分支

下一篇: 如何清除“这个分支是N提交主人”?