Reputation: 3193
I'm new to git, and still having a lot of trouble.
Say that I'm working on a.cpp
. I modified some code in a.cpp
. And, that change is not ready to commit or push.
Then, other people also made a change in a.cpp
.
In SVN/CVS, checking out do either a merge or conflict.
I thought that git pull
does the same thing.
But, it seems that git pull
doesn't merge/conflict. Is this correct behavior?
Also, git checkout
just simply rewrites a.cpp
, losing all my changes.
Is there any easy way to pull the latest version and perform merge/conflict?
Upvotes: 4
Views: 77
Reputation: 7720
Before you pull, stash your changes. Then after your pull, you can pop your stashed changes and rebase them on the newest commit.
first stash all your changes
git stash
You can view your stashes by running stash show
. If you haven't stashed anything before you should now see one stash. You can now pull without overwriting your changes:
git pull
Now remove your changes from the stash and apply them to the currently checked out version:
git stash pop
Upvotes: 5