RSS

Category Archives: Source Control

My GIT cheat sheet

I’ve finally made the leap from SVN to GiT as my solution for source control and so far I’m impressed, especially with how easy it is to maintain and create multiple branches of code. ¬†Gone are the days of creating more than one branch at the same time leading to a world of merging pain.

2 things I came across though quite early on though;

  1. SSH seems to be much more stable than https
  2. and Git Bash is a great client once you learn the commands.

Needless to say there are lots of commands for GiT giving the user complete flexibility over their code base but so far I’ve managed to get by with this sub set of commands:

Retrieve a repository from Git Hub

git clone ssh/https location

Show the status of the current code branch

git status

Show the check in and revision status

git log –graph

Show all available branches

git branch -a

Switch to another branch

git checkout branchname

Create a new branch from the current branch

git checkout -b newbranch parentbranch

Commit any changes to your local repository

git commit -am “check in message”

Merge your branch back into the parent branch

git checkout parentbranch

git merge –no-ff newbranch

Push changes back to the main repository (Git Hub)

git push origin parentbranch

Get latest changes from the main repository into branch

git pull origin branchname

Advertisements