Chris Halcrow
Chris Halcrow

Reputation: 31940

Git checkout doesn't get latest changes

I've made a number of commits to a Git branch, synched them to the repository, and then checked out a fresh copy of the branch onto another computer using:

git checkout

however the latest change that I'm seeing on the 2nd computer is a few steps behind the version on the 1st computer. I've tried a:

git reset --hard head

on the branch, on the 2nd computer. What is happening?

Upvotes: 1

Views: 1421

Answers (2)

raina77ow
raina77ow

Reputation: 106365

Git repository usually has its own version of remote refs, updated each time you do git fetch <remote-name> (on its own or as part of git pull <remote-name> <branch-name> operation). The point is, git checkout uses this information without checking the corresponding remote. In other words, if someone updates the branch on remote, you won't be able to get those updates with git checkout - you'll have to pull the necessary information from remote first.

Upvotes: 3

PlainOldProgrammer
PlainOldProgrammer

Reputation: 2931

try

git checkout <your_branch>

Upvotes: -1

Related Questions