Git: how can I combine my work file with the last

I am new to git and still have big problems.

Say I'm working on a.cpp . I changed the code in a.cpp . And this change is not ready to commit or click.

Then other people also made changes to a.cpp .

In SVN / CVS, validation is performed either by merge or by conflict.

I thought git pull does the same thing.

But, it seems that git pull not merging / not conflicting. Is this the right behavior?

In addition, git checkout just overwrites a.cpp , losing all my changes.

Is there an easy way to pull the latest version and perform a merge / conflict?

+4
source share
2 answers

Before you pull, write down your changes . Then, after your attraction, you can put your hidden changes and reinstall them on the latest commit.

write down all your changes first.

 git stash 

You can view your stamps by running stash show . If you have not hidden anything before you should see one cache. Now you can pull without overwriting your changes:

 git pull 

Now delete your changes from the wallet and apply them to the current verified version:

 git stash pop 
+5
source

Another way is to do NOT push. Then reinstall from the remote.

0
source

Source: https://habr.com/ru/post/1468857/


All Articles