Short version: the commit made in master by a coworker appears as if it had been done in a branch I just pushed. The scenario is very simple but I don't understand what happened.
I only did two things.
First, I created a branch from master (locally, in a freshly clone repository) and switched to it.
(master) $ git checkout -b my-branch
Switched to a new branch 'my-branch'
I made no other change and about ½ hour later, I pushed the branch (I would have done it immediately but got interrupted).
/c/myrepo (my-branch)$ git push -u origin my-branch
Counting objects: 7117, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4111/4111), done.
Writing objects: 100% (7117/7117), 30.37 MiB | 2.35 MiB/s, done.
Total 7117 (delta 2773), reused 7117 (delta 2773)
To https://stash/myproject.git
* [new branch] my-branch -> my-branch
Branch my-branch set up to track remote branch my-branch from origin.
Then I went to Stash to check the branch shows up. To my surprise, it looked like below. My coworker, John Doe, had committed a change in master
. However, in reality he did so in his master which tracks origin/master
(he was not aware of my branch nor interested in it, he was developing as usual). For some reason, Stash shows that changed as if committed in my-branch.
I don't understand this. It's as if git push
also got the latest from origin/master and pushed those changes as part of my-branch. But this was a new branch that no one knew about.
I still have that local repo and can run any debugging commands, if needed. Thanks.
Here's what I see locally.
C:\myproject>git remote show origin
* remote origin
Fetch URL: https://stash/myproject.git
Push URL: https://stash/myproject.git
HEAD branch: master
Remote branch:
master tracked
Local branches configured for 'git pull':
master merges with remote master
my-branch merges with remote my-branch
Local refs configured for 'git push':
master pushes to master (up to date)
my-branch pushes to my-branch (up to date)
We are all using Git 2.10.0 and Atlassian Stash v3.11.1.