Conflicts when I have no changes
I'm trying to understand Git, I'm pretty new to it. I have a fork on Github that I forked from someone else's repository and I'm trying to contribute to his repository.
I do my changes and I'm happy so I want to do a pull request. But I can't do the pull request because Github for Windows says it can't be merged with no conflicts. So I do:
git fetch upstream
git merge upstream/master
And then I get some conflicts from some stuff the other guy did, which I resolve using Beyond Compare.
I then create a pull request by clicking the create pull request in Github for Windows. Then he looks at my changes, but he's never happy with them so he makes little modifications and then commits to his branch. The change on his fork just shows 1 commit with my avatar and his avatar in the corner.
So I figure I should get his new version so I do:
git fetch upstream
git merge upstream/master
again.
Doing this gives me another ton of conflicts that I have to resolve. I don't understand why I'm getting conflicts, I haven't done anything since my last merge. Shouldn't I just be getting an exact copy of his fork?
Also my pull requests seem to list all the commits I've done since I started contributing to the project, shouldn't it just show the commits since my last pull request?
Edit:
As requested by bg17aw here are my git config --list settings
alias.c=commit
alias.co=checkout
alias.dt=difftool
alias.mt=mergetool
alias.praise=blame
alias.ff=merge --ff-only
alias.st=status
alias.sync=!git pull && git push
apply.whitespace=nowarn
core.symlinks=false
core.autocrlf=true
core.editor=gitpad
core.preloadindex=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
color.ui=true
pack.packsizelimit=2g
help.format=html
http.sslcainfo=/bin/curl-ca-bundle-ghfw.crt
sendemail.smtpserver=/bin/msmtp.exe
diff.astextplain.textconv=astextplain
rebase.autosquash=true
credential.helper=!github --credentials
filter.ghcleansmudge.clean=cat
filter.ghcleansmudge.smudge=cat
push.default=upstream
diff.tool=vs2013
diff.algorithm=histogram
difftool.prompt=false
difftool.bc4.cmd="c:/program files (x86)/beyond compare 3/bcomp.exe" "$LOCAL" "$REMOTE"
difftool.p4.cmd="c:/program files/Perforce/p4merge.exe" "$LOCAL" "$REMOTE"
difftool.vs2012.cmd="c:/program files (x86)/microsoft visual studio 11.0/common7/ide/devenv.exe" '//diff' "$LOCAL" "$REM
OTE"
difftool.vs2013.cmd="c:/program files (x86)/microsoft visual studio 12.0/common7/ide/devenv.exe" '//diff' "$LOCAL" "$REM
OTE"
merge.tool=bc3
mergetool.prompt=false
mergetool.keepbackup=false
mergetool.bc3.cmd="c:/program files (x86)/beyond compare 3/bcomp.exe" "$LOCAL" "$REMOTE" "$BASE" "$MERGED"
mergetool.bc3.trustexitcode=true
mergetool.p4.cmd="c:/program files/Perforce/p4merge.exe" "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
mergetool.p4.trustexitcode=false
user.name=dallasm15
filter.hawser.clean=git hawser clean %f
filter.hawser.smudge=git hawser smudge %f
filter.hawser.required=true
diff.tool=bc4
difftool.bc3.path=c:/Program Files (x86)/Beyond Compare 4/bcomp.exe
difftool.bc4.path=c:/Program Files (x86)/Beyond Compare 4/bcomp.exe
push.default=simple
filter.lfs.clean=git lfs clean %f
filter.lfs.smudge=git lfs smudge %f
filter.lfs.required=true
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
core.hidedotfiles=dotGitOnly
remote.origin.url=https://github.com/dallasm15/Khazad.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
remote.ImpalerWrG.url=https://github.com/ImpalerWrG/Khazad.git
remote.ImpalerWrG.fetch=+refs/heads/*:refs/remotes/ImpalerWrG/*
remote.upstream.url=https://github.com/ImpalerWrG/Khazad
remote.upstream.fetch=+refs/heads/*:refs/remotes/upstream/*
branch.digging_creates_rocks.remote=origin
branch.digging_creates_rocks.merge=refs/heads/digging_creates_rocks
The diffs mostly show him replacing my spaces with tabs.
I don't have enough rep to post a comment, but hope this will help as an answer:
I don't understand why I'm getting conflicts, I haven't done anything since my last merge
Since you have no changes, there is nothing to stash. I would use in this case:
git fetch origin
git reset --hard origin/master
(your remote might be named differently).
I don't understand why I'm getting conflicts, I haven't done anything since my last merge. Shouldn't I just be getting an exact copy of his fork?
If you keep having the issues every time, you might have an issue regarding git settings. You can see your settings using:
git config –list
Now if possible, you should also check the settings of the repo owner. Look for core.autocrlf=true
to check if line endings are not the issue (if he is using a Mac/Linux and you are using a Windows machine, there is a chance of this happening).
Also look for core.filemode=false
. This would prevent file permissions being tracked (if yours is set to true, change it to false). Git only knows about 755 and 644.
Another possible reason for your problem is whitespace (tabs v spaces). SUGGESTION: always use setting to set TAB = 4spaces. Again, you should get in sync with the repo owner. Depending on what IDE you are using, you can set it to match the setting of the repo owner.
Other useful things you might try to get to the bottom of this:
run git diff filename
on one file and add the output to your question
use Sourcetree as a free GUI to help you with long lists of file with conflicts (you will still be able to use command line to progress with your understanding of git)
Try doing: git pull --rebase
It stashes your changes first pulls the upstream's changes and then stash pop and apply your changes on top of it.
链接地址: http://www.djcxy.com/p/45122.html上一篇: 如何使用`git merge`来达到与`git pull`相同的结果?
下一篇: 当我没有变化时发生冲突