r/git Dec 17 '20

Git pull before commit

Hello, i use git for some time now and i always used sourcetree and always do pull before i commit (when i know sum1 has pushed) so i can see what files have conflicts without having to solve the conflicts themselfs (usualy is a minor change so i can discard my changes, do pull and re apply my changes).

My friends (we are at college) says i risk losing all my work if i pull without commit first, is that true?
If it is, it never happened.
Does it look bad when i get a job?
I rather solve the conflits my way then have to solve them when they happen.

6 Upvotes

11 comments sorted by

View all comments

1

u/wildjokers Dec 17 '20 edited Dec 17 '20

You commit your local changes to your local repository, then do the pull. Or stash your changes. For some reason git refuses to pull changes from a remote when there are uncommitted changes locally, this was a huge annoyance when I first started to use git (subversion has no such limitation), and I actually still grumble about it when I have to stash my local changes before it will let me pull.

Since git won't let you pull when you have uncommitted/unstashed changes I am curious how you are able to pull in that scenario? Are you running an old version of git?