Reputation: 6041
For example: there is a local and remote repo with two files:
1.txt
2.txt
Developer #1 edits 1.txt
locally and commits the changes without pushing them to remote repo.
Later, developer #2 sends pull request with edited 2.txt
, and it gets merged in main remote repo.
My question is: how can developer #1 pull 2.txt
from remote repo, and keep changes to 1.txt
?
When I try to do this, extra commit is added after 1.txt
edit, so it looks like this:
2.txt
commit from developer #21.txt
commit from developer #1Merge branch "master" of https://github...
(2.txt
commit again)Thank you.
Upvotes: 3
Views: 3535
Reputation: 13725
You should use
git pull --rebase
Your commit would be replayed after the other one this way, so its sha hash will change, but otherwise it will be the same. And this way you can avoid the extra "merge commit".
Upvotes: 7