jww
jww

Reputation: 102205

Why is Git not push'ing a merge?

I'm trying to merge this pull request. I performed the following steps (taken directly from Bash history):

git checkout -b wyattoday-fix-junk-defines master
git pull https://github.com/wyattoday/cryptopp.git fix-junk-defines
git checkout master
git merge -S --squash wyattoday-fix-junk-defines

I tried to push with both a git push origin master and git push. In both cases Git returns:

$ git push origin master
Username for 'https://github.com': noloader
Password for 'https://[email protected]':
Everything up-to-date

Everything cannot be up-to-date because I merged the patch. After the change I am not seeing the code that was removed:

$ grep WORKAROUND_MS_BUG_Q258000 *.h *.cpp
$

I verified I am on Master:

$ git branch
* master
  noloader-master
  wyattoday-fix-junk-defines

Why is Git not push'ing a merge? How do I work around the problem?

Upvotes: 0

Views: 70

Answers (1)

Chris
Chris

Reputation: 136880

If you run git status I believe you'll find that your working copy includes staged changes matching those introduced in the pull request:

On branch master    
Your branch is up-to-date with 'origin/master'.                                 

Changes to be committed:                
  (use "git reset HEAD <file>..." to unstage)                                   

        modified:   config.h            
        modified:   osrng.h

git diff --cached should show diffs that similarly match the PR. This is because of the --squash option to git merge, which doesn't actually create a new commit (my bold):

Produce the working tree and index state as if a real merge happened (except for the merge information), but do not actually make a commit, move the HEAD, or record $GIT_DIR/MERGE_HEAD (to cause the next git commit command to create a merge commit). This allows you to create a single commit on top of the current branch whose effect is the same as merging another branch (or more in case of an octopus).

Commit those staged changes, then push.

Upvotes: 1

Related Questions