Is it possible to fast forward another branch without checking it out?

In git, I have a branch A. I create another branch B where I create few commits. Then I want to fast forward branch A to branch B.

I know that I can checkout A and do fast forward to the latest commit of B. This operation requires two modifications of working copy: the first to return to A and then revert working copy to B. If new commits on B contain a lot of changes, the operation could be quite slow.

  • How can I make git list only the tracked directories in a folder?
  • git post-receive hook can not jump back into original cwd
  • How can I search Git branches for a file or directory?
  • How to specify a git commit message template for a repository in a file at a relative path to the repository?
  • Cause of change from `-arch ppc` to `-arch ppc7400`?
  • How to checkout a remote branch in Git?
  • Is it possible to do fast forward another branch without changing the working copy? (in other words, to move just the pointer of A)

  • Octopress deployment to gh-pages
  • Push to a remote origin on a subfolder of git repository?
  • Untracked and changed files are the same
  • fatal: Not a git repository (or any of the parent directories): .git
  • git merge fails refusing to lose untracked file
  • Resolving conflict in git
  • One Solution collect form web for “Is it possible to fast forward another branch without checking it out?”

    Git provides the update-ref command for this purpose

    git update-ref A B

    Note: This command is one of the lower-level Git commands and does not provide any safeguards for you to keep from screwing yourself up. If B is not a fast-forward of A it will still update A, potentially making commits unreachable and subject to garbage collection.

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