Home > other >  Result of git fetch
Result of git fetch

Time:12-25

I wanted to fetch a remote branch of a project from github. However, I forgot to switch branches and when I ran the command, I was in the main branch on my local computer.

The command I ran was: git fetch https:<access_token>github.com/user/repo.git email

The results were:

remote: Enumerating objects: 23, done.
remote: Counting objects: 100% (23/23), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 14 (delta 8), reused 14 (delta 8), pack-reused 0
Unpacking objects: 100% (14/14), 2.45 KiB | 93.00 KiB/s, done.
From https://github.com/macumhail/otools
 * branch            email -> FETCH_HEAD

I don't want to merge the "email" branch with main yet. I am a git novice and I'm not sure what I've done. Is there a way to undo the fetch and do I even need to?

Thank you for any ideas.

CodePudding user response:

Not to worry. git fetch has no effect whatever on your local branches! All it does is bring the "remote-tracking" branches up to date. It makes no different what local branch you are "on" at the time you fetch. Fetching is always good. Fetch early and often — keeping in mind, of course, that this is one of the few Git commands that actually networks with your remote.

CodePudding user response:

All is fine.

git fetch https:<access_token>github.com/user/repo.git email

The git fetch command is how we get commits from some other repository, into our own local repository. Commits are why Git exists, and hence are the all-important part, so this is a perfectly reasonable and normal thing to do.

I am a git novice ...

The good part about being a novice is that you won't have a lot of wrong ideas to un-learn.

  •  Tags:  
  • git
  • Related