Background:
I've got what I perceive to be a simple scenario. I've committed changes locally and now I want to merge what's on the remote, in the same branch (ahead of me) into the local, working directory.
git branch -vv --list --all
gives the following:
master 79d9d4e [origin/master: behind 7] Footprint UI working
remotes/origin/HEAD -> origin/master
remotes/origin/master a86a1a9 Added sample data to webpage
There's one file in particular that I'd like to merge. Here's the diff:
git diff --stat a86a1a9 79d9d4e views/footprint.handlebars
views/footprint.handlebars | 65 +++++++++++++++++++++++++++++++++--------------------------------
1 file changed, 33 insertions(+), 32 deletions(-)
But when I run git pull
, the version of the file in my local commit is overwritten by that of the remote. In more verbose terms:
$ git fetch -v origin
From github.com:githubusername/foo
= [up to date] master -> origin/master
$ git merge origin
Updating 79d9d4e..a86a1a9
Fast-forward
...
views/footprint.handlebars | 65 ++++++++++++++++++++++++++++++++---------------------------------
...
6 files changed, 220 insertions(+), 59 deletions(-)
create mode 100644 static/search.js
create mode 100644 views/search.handlebars
I've read over the following posts:
And have tried these commands:
git pull --rebase
overwrites the local version of the filegit merge -s recursive -X ours
overwrites local version of filegit merge -s ours
prompts for commit message and then overwrites remote changesgit rebase remotes/origin/master
says that it will "replay my work on top of" head, but still overwrites itgit merge --no-ff --no-commit
literally reports "Automatic merge went well; stopped before committing as requested" when it's overwritten the file
(After running each of the above, I checked the file in question and, noting that it was overwritten, ran git reset --hard master@{"5 minutes ago"}
)
$ git config --list
redential.helper=osxkeychain
user.name=My Name
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.precomposeunicode=true
remote.origin.url=git@github.com:githubusername/foo.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
user.email=email@address.com
remote.heroku.url=https://git.heroku.com/foo.git
remote.heroku.fetch=+refs/heads/*:refs/remotes/heroku/*
$ git log --oneline --decorate --simplify-by-decoration --all -10
a86a1a9 (origin/master, origin/HEAD) Added sample data to webpage
79d9d4e (HEAD -> master) Footprint UI working
c53160d Initial commit
$git log --format="%h %ci %cn" views/footprint.handlebars
79d9d4e 2019-03-12 19:04:08 -0400 chb
fada3fa 2019-03-10 13:59:41 -0700 JA
9641499 2019-03-08 16:48:14 -0800 JA
1759509 2019-03-08 12:32:08 -0800 GitHub
bfe443e 2019-03-07 16:41:18 -0800 JA
git version 2.17.2 (Apple Git-113)
Question:
Why is this conflict not being flagged as such by git
, with the appropriate markers (<<<<<<< HEAD
, =======
, >>>>>>>
) being added to the relevant file?