Troubleshooting 'git checkout'

I've got a "You are on a branch yet to be born" error in a new repository
This is a common issue in older versions of Git, where you need to have a commit in order to switch branches. You'll need to make your initial commit to master, then switch to your version branch (7.x-1.x) and push that (git push origin 7.x-1.x). Once you've switched branches, you can delete the master branch from your local repository.

Getting started with Git (for Drupal) on Windows

New to Git? Take a look at Introduction to Git.

Install Git on your local machine

Download Git for Windows. Follow the link Download for Windows.

Install using default settings only.

Add Git Bash to the Taskbar. Open Start menu and type git. Right-click Git Bash then click Pin this program to the taskbar. In taskbar, right-click Git Bash icon, then right-click Git Bash, then click Properties.

  • Shortcut tab: Set the Start in option to your local server's root directory (e.g c:\xampp\htdocs)
  • Options tab: set Buffer Size to 500 or something large (Buffer size is number of lines for scrollbar to go back), check Quick Edit checkbox.
  • Click OK to close Properties dialog.

Configure git user. Open your Drupal.org account, click Edit, then Git access. Copy Git user configuration and paste it into Git Bash. Lines should look like this:

git config --global user.name "Your Name"
git config --global user.email you@example.com
git config --global core.autocrlf true

Hands-on: Hook up with an GIT repository

For git you need the "GIT backend" module.

Here is an example of using GIT backend:

Step 1: create an bare GIT repository (skip this if you already have one)

mkdir bare.git
cd bare.git
git init --bare

Step 2: set up your Drupal site with that repository

  1. Enable the "Version Control API", "Commit Log" and "GIT backend" modules.
  2. Flush cache.
  3. Assign role permissions for for "Administer version control systems"
    (by default nobody has any permissions)
  4. Go to Configuration > Development > Version Control settings (url: /admin/config/development/versioncontrol-settings)
  5. Set "Git binary path". (Notice: Can be problems with Windows OS. On *nix OS there are no problems with path)
  6. Go to Content > VCS repositories > Add Git repository in the admin area. (url: /admin/content/versioncontrol-repositories/add-git)
  7. Repository name: "Test repo", or whatever.
  8. Repository root: "/path/to/repository/bare.git".
  9. For other settings follow fields descriptions(and check "Web viewer URL handler" because by default it's not set. Might it'll be fixed in closest time)
  10. Save the repository.
  11. Enable the "Commit messages" menu entry, or go directly to the "/commitlog" path.

Using git blame

The git blame command can be used to determine when a certain change was made. This document will explain how to use this functionality in the terminal and in Drupal's git repository browser at drupalcode.org.

Pages

Subscribe with RSS Subscribe to RSS - git