Last updated November 23, 2012.

The following is a collection of git commands that will create problems to your git repository. If you encounter a problem that is not yet listed here, feel free to edit the page and add to it.

  1. To see details about the git repository for your project look here: http://drupalcode.org/project/<project-name>.git/. You can see all the logs, tags, diffs, etc.
  2. You can't branch using normal techniques in an empty repository. The project maintainer guide tells you how to do an initial commit first and after that you can rename the current branch with git branch -m [branch_name]. For example: git branch -m master 7.x-1.x
  3. git checkout remotes/origin/6.x-1.x this will not work since git can only checkout local branches. The remote branches are not the same as local branches, they are just placeholders for git to remember where that remote branch was when you pulled last. You will need a local tracking branch in order to interact with a branch (make commits, tags, push, etc). This is not entirely trivial to avoid because if you git clone git://git.drupal.org/project/views.git and then try to switch to a given branch, then git branch won't show you much -- you need to run git branch -a to see every branch which looks like this:
    * master
      remotes/origin/4.6.x-1.x
      remotes/origin/4.7.x-1.x
      remotes/origin/5.x-1.x
      remotes/origin/6.x-2.11-security
      remotes/origin/6.x-2.x
      remotes/origin/6.x-3.x
      remotes/origin/7.x-3.x
      remotes/origin/HEAD -> origin/master
      remotes/origin/d7v3ui
      remotes/origin/master

    You should simply know that git checkout 7.x-3.x will create a local tracking branch for the corresponding remote branch for you.

  4. While git push origin master:6.x-2.x is syntantically valid, it actually would push your local branch called master on the remote branch 6.x-2.x. Never do that. Just use git push origin 6.x-2.x. The only time you need the colon is when you want to delete a remote branch: git push origin :6.x-3.x deletes the 6.x-3.x branch.
  5. Creating a branch requires a checkout with the -b flag git checkout -b 7.x-1.x (after a clone of your 6.x-1.x branch.) It is easy to think that using git tag 7.x-1.x instead, but that doesn't work. It only tags your current branch with an invalid tag. The result is certainly not what you'd expect! If you create a tag and push it in, you then will need to remove it: git tag -d 7.x-1.x deletes the tag from your local folders. However, you cannot push the normal way since the tag is now gone. Instead, you use this syntax: git push origin :refs/tags/7.x-1.x. (See reference)
nobody click here