After pushing changes from one client to a remote repository, how can I get them into the workspace of another?

Every time I push changes from my git repo to my staging server, I have to use the following command to complete overwrite the changes.

git fetch --all && git reset --hard origin/master

Why can’t I just do git fetch?

  • Where are the Git man pages online?
  • How to update my server files from a git repo automatically everyday
  • Bower: ENOGIT Git is not installed or not in the PATH
  • Git switch to master and bring untracked files along
  • Azure Git deploy into site folder not wwwroot
  • Move specific git commit from master to branch
  • Files disappear when commit branches in Eclipse
  • Git command to checkout any branch and overwrite local changes
  • Possible to dry-run a `git revert`?
  • Create a Git server on Local Network without using third party software or applications
  • Bash completion: Honor repository-specific Git alias in alias completion
  • Git tree-filter run python script on commits
  • One Solution collect form web for “After pushing changes from one client to a remote repository, how can I get them into the workspace of another?”

    If you want to pull changes you need to use git pull not git fetch. fetch does only download the changes into the repository (and updates the remote branches). It does not update the workspace.

    git pull is a shortcut for git fetch && git merge <branch>. See for example the GitHub help.

    I typically use an alias fe = fetch --all -v -progress -p which I run often just to see what changes and differences happen. This can be done without thinking as it does not touch your workspace, require merging or similar (that is why git fetch is a useful command even if it has no obvious effect to the workspace). It does for example help with git status as it can tell you, that you are behind the remote branch (and need to run git pull --ff-only or similar).

    Git Baby is a git and github fan, let's start git clone.