Git with centralized workflow

I am new to git and I am using a centralized workflow similar to svn. I would like to know periodically that my status is compared to a central repo. For example, if I run the following commands ...

$ git clone git@github.com :centralrepo/test.git $ cd test; <make some changes inside test/> $ git commit -a $ git pull 

... git pull says "already updated". Why doesn't git display a change report report, and if this is the correct behavior, is there a way to find out that my locale is not synchronized with the remote?

+4
source share
3 answers

git pull will pull any changes made to the remote repository to your equivalent svn update . However, he will not mention if at your end there have been changes that are not on the remote control. You can also do git fetch to receive updates from a remote device without applying them to your workspace.

In recent versions of git (e.g. 1.7.2.3 here) git status print some information to help you see this, for example:

 # On branch master # Your branch is behind 'origin/master' by 20 commits, and can be fast-forwarded. 

This shows up after I did git fetch and means there are changes awaiting transition to my workspace (applied when doing git pull )

In contrast, if I pull them in and make and make changes locally, git status tells me:

 # On branch master # Your branch is ahead of 'origin/master' by 1 commit. 

That is, I have local changes that can be clicked on remotely. Then I could list them by running git log origin/master..

+7
source

The git pull command simply pulls changes from the remote repo and merges them into a local branch.

If you want to see the difference, you should use git br -a to display the remote branches, and then git to distinguish the remote branch from tracking your local branch.

+3
source

Just use git fetch to update remote branches in your local repository. A dialog box will show you if something was uploaded, which you then compare using git diff or git log .

+1
source

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


All Articles