I often face this problem with git:
I clone a git repo of some project. Then I make changes to some source file, but I don’t commit it, because my work is not complete. But I have to keep updating my repo to make it in sync with the master. So I do a ‘git pull’, so that my repository is up-to-date and so I can produce my patch against the latest repo.
Now suppose I edit the file hello.c in my local clone (not yet committed) and someone else has made changes to the same file and committed it to the master repo. Now when I do ‘git pull’ the other person’s changes get added to hello.c and the changes that I had made, get deleted. This is the natural behavior obviously.
Is there a way to tell git to only ‘add’ changes and not ‘subtract’ anything? Or something to that effect? I don’t want my changes to be deleted when I do a git pull, but also I want to work with the latest repository.
I often face this problem with git: I clone a git repo of some
Share
git pull– read FM! Learn difference between pull and fetch or see at examples in Git Reference