Git fetch says success, but nothing loads

I am having serious problems with git and I cannot find any solutions on the Internet. I am a new user, so I may be doing something wrong ...

I have a repository hosted on Github and someone from my team just pushed a new commit. Using the Git GUI on Windows, I tried to extract a new post from Github. Git said the fetch was successful, but no changes were found / uploaded.

I tried to create a new remote in Github and used it. (e.g. git @ github.com: MyUserName / MyProject). When retrieving from this remote, Git talks about success and lists each branch as updated. However, none of the branches load. If I run the selection again, the same message will be displayed.

I had the same problem a couple of days ago with the same repository. I “fixed” it by deleting my local repository and cloning the repo from Github. But apparently, this was only a temporary fix, as the problem returned again.

Any guidance is greatly appreciated!

SOLVED: You were right, I needed to unite after making changes. (Unfortunately, the Git GUI does not allow pulling) I assume that the Git GUI used this automatically, but maybe I accidentally changed the settings at some point. Thanks for all the info!

+4
source share
3 answers

As another answer says, fetch just gets new commits in your history, but only updates the “remote tracking branches”. These are links to new commits, but not the local branches you are working on.

If you want to update the local branch using the remote tracking branch, you want to use git pull .

I would advise better git fetch instead of git pull , and then check what has changed on the remote branch using git log --all or gitk --all or some other way of checking history. When you know what changes you will bring and their nature, you can now git merge origin/some-branch or git rebase origin/some-branch update the local branch to include the changes.

+5
source

fetch does exactly what happens in your case: it transfers the changes to the local Git (synchronizes the repositories), but does not merge these changes into its branches and does not update your working copy. I believe that the verb you are looking for is pull .

What is the difference between 'git pull' and 'git fetch'?

+6
source

Typically, pull = fetch + merge. Sometimes you may not see any changes after the "fetch". You must use "pull" to view real updates. I do not know the reason.

0
source

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


All Articles