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.
- 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. - 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 git checkout remotes/origin/6.x-1.xthis 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 yougit clone git://git.drupal.org/project/views.gitand then try to switch to a given branch, thengit branchwon't show you much -- you need to rungit branch -ato 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/masterYou should simply know that
git checkout 7.x-3.xwill create a local tracking branch for the corresponding remote branch for you.- While
git push origin master:6.x-2.xis syntantically valid, it actually would push your local branch calledmasteron the remote branch6.x-2.x. Never do that. Just usegit 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.xdeletes the6.x-3.xbranch. - 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 usinggit tag 7.x-1.xinstead, 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.xdeletes 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)