2

Coming from Subversion I am used to "svn status -u" to check if I will get conflicts before checking in to the remote repo.

Can it be done in same easy way with GIT? preferable before commiting locally.

user2733007
  • 21
  • 1
  • 2

1 Answers1

3

Here's one way to do it. First, fetch any changes from the remote:

git fetch <remote>

Now let's assume that you've made uncommitted changes to master, and you want to see what has changed in <remote>/master. Then simply use the following:

git diff --name-status master <remote>/master

That will show the list of changed files, along with their status.

Now if you've actually committed changes to your local master and you want to see what could potentially conflict, you could simply just do the merge locally to try it out, then reset it back to where it was if you don't like the results:

git checkout master
git merge <remote>/master

# Don't like the results, reset
git reset --hard head^

There are also other ways to get this information, I'll add them later.