I’m having some serious issues with git, and couldn’t find any solutions online. I’m a new user, so I may be doing something wrong…
I have a repository hosted on Github, and someone on my team just pushed a new commit. Using Git GUI on windows, I attempted to fetch the new commit from Github. Git said that the fetch was a success, but no changes were found/downloaded.
I attempted to create a new remote to Github and used that instead. (e.g. git@github.com:MyUserName/MyProject). When fetching from this remote, Git says success and lists every branch as being newly updated. However, none of the branches get downloaded. If I run fetch again, the same message is displayed.
I had this same problem a couple days ago with the same repository. I ‘fixed’ it by deleting my local repository and cloning the repo from Github. But apparently it was only a temporary fix, as the problem is back again.
Any guidance is much appreciated!
SOLVED: You were right, I needed to merge after fetching the changes. (Sadly, Git GUI does not allow for pulling) I’m assuming that Git GUI used to do this automatically, but perhaps I accidentally changed the options at some point. Thanks for all the information!
As the other answer says,
fetchjust gets the new commits into your history but updates only the “remote tracking branches”. These are references to the new commits but are not local branches that you work on.If you want to update your local branch with what the remote tracking branch will have, you want to use
git pull.I would advise that it is better to
git fetchinstead ofgit pulland then inspect what has changed on the remote branch withgit log --allorgitk --allor some other way of inspecting the history. When you are aware of what changes you will be bringing in and their nature, you can nowgit merge origin/some-branchorgit rebase origin/some-branchto update a local branch to include the changes.