Using GIT

Name: Mischa Tuffield


Git not Github

What is Git

Distributed Version Control

Git consists of


Please ...

Cloning a repository

History - Changing a file

History - see exactly what changes have been made

History - Create a "commit" Step 1 - add

History - Create a "commit" Step 2 - commit

History - Pushing history upstream

History - Listing the history

History - show changes in a given commit

History - Exactly who changes what line when

History - Refreshing your repo to the latest checout

Using --rebase, you might not want to commit



Demo :)


Create branches for new features, for significant changes


So the commits A, C and E are on "stable" and A, B, D and F are on "new-idea". If you then merge "new-idea" onto "stable" with the following commands

    git checkout stable   # Change to work on the branch "stable"
    git merge new-idea    # Merge in "new-idea"

And then you have the following ...

  A-----C----E----G ("stable")
    \             /
      B-----D-----F ("new-idea")

If you carry on committing ...

Resetting work in a branch

    last version from another repository
      M---N-----O----P---Q ("master")

Resetting work in a branch 2

   git branch dubious-experiment

  M---N-----O----P---Q ("master" and "dubious-experiment")

Resetting work in a branch 3

   git checkout master

  # Be careful with this next command: make sure "git status" is
  # clean, you're definitely on "master" and the
  # "dubious-experiment" branch has the commits you were working
  # on first...

  git reset --hard [SHA1sum of commit N]

         M---N-------------O----P---Q ("dubious-experiment")

This reverts the master branch ignoring the dubious experiment

Listing branches

Creating a local branch (only you, not working with others)

Checking out a remote branch

Creating a remote branch

Cherry-picking changes in git

Tagging your git repo

GIT Config