How to pull on sourceTree (from git) while ignoring errors?

Jayn a March 22, 2016

I've pushed my changes to git using sourcetree, my friend made some changes. In the meantime, I've changed some irrelevent files also - which I don't care to lose. However. when pulling from sourcetree I receive errors (because our files our different). How can I pull from sourcetree while ignoring the erros? (again, I don't care about my directory. just want to get my friend's changes that are the most up to date - we're working on the same files).

3 answers

2 votes
Johannes Kilian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 22, 2016

This is rather a git than a sourcetree question.

You want to do a forced sync: Overwriting your local changes with the current state of the remote repository.

What I do in this situation - via git commandline:

git reset --hard
git fetch --all
git reset --hard origin/master

This discards all my local chances and fetches the latest chances from origin/master

 

Jayn a March 22, 2016

Where do I write these commands ?

Johannes Kilian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 22, 2016

Within sourcetree you can open the git commandshell:

SourceTree_2016-03-22_11-29-58.png

 

Like Fonso15 likes this
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 22, 2016

If you haven't committed the irrelevant changes, you can use the Discard button.

If there are files that are irrelevant, you might consider removing them from the repo ("stop tracking"), and then adding those files to your git ignore list.

0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 22, 2016

I think you're right Tim. I read "irrelevant files...which I don't care to lose" as "irrelevant files which I don't care if I lose". Not sure what's trying to be achieved here.

0 votes
Tim Crall
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 22, 2016

I'm not convinced that I understand the question correctly, and I'm not convinced that the answers below do, either.  You said you have irrelevant changes that don't want to lose, but your friend has changes?  Are these source files?  If they are, then I don't understand what you mean by saying that they are irrelevant and yet you don't want to lose them. You either need to accept your friends changes or not.  Git is not well suited for accepting changes on some files but not others, except in the case of resolving conflicts.  If they're not source files but are files that just happen to be in the same directory, then, as Seth notes, they should be removed from tracking and ignored.   

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events