TIPS: Drupal and Git repository management and versioning

There was a world of version control suffering before Git, and then a nicer world after Git. Thanks Linus yet again !

From Wikipedia:

Git (/ɡɪt/ is a distributed revision control system with an emphasis on speed, data integrity, and support for distributed, non-linear workflows. Git was initially designed and developed by Linus Torvalds for Linux kernel development in 2005, and has since become the most widely adopted version control system for software development.

As with most other distributed revision control systems, and unlike most client–server systems, every Git working directory is a full-fledged repository with complete history and full version-tracking capabilities, independent of network access or a central server.

By far and away the best thing about Git compared to previous repository control systems is the ability to very easily create branches (such as small branches dedicated to fixing a specific problem or developing a feature) and then merge them back onto a main branch.

There are now more Git clients than you can poke a stick at, but my current favourite is Atlasssian SourceTree used in parallel with NetBeans IDE as my PHP coding environment for Drupal and the Git command line client, which work together completely seamlessly.

QUICK TIP: renaming a local Git branch:
git branch -m <oldname> <newname>

If you want to rename the current branch, you can simply do:

git branch -m <newname>
QUICK TIP: Delete a branch both locally and remotely.


git branch -D [branchname]

Remotely, old style (note the ':' colon):

git push origin :[branchname]

Since Git 1.7 clearer syntax option:

git push origin --delete [branchname]
Visit also