git-presentation/Presentation.org

1.7 KiB

Git 101

Concepts

  • Version control system (VCS)
  • Distributed
  • De facto standard for code collaboration

Reality

  • Powerful system with hard to grasp concepts
/coolneng/git-presentation/media/branch/master/assets/xkcd.png
xkcd

Structure of a git project

  • The working directory is the folder where we want to manage our project
  • The index is an intermediary step between the files in the directory and the commits
  • A commit is a full snapshot (i.e. copy) of the contents of the working directory at some point
/coolneng/git-presentation/media/branch/master/assets/staging.png
Structure of a project

Branches

  • A branch is a way to diverge from the commits
  • It allows multiple people to work on the same project without conflicts

/coolneng/git-presentation/media/branch/master/assets/branch.png /coolneng/git-presentation/media/branch/master/assets/divergence.png

Remotes

  • The real advantage of git is allowing multiple people to work on the same project from different locations
  • A server is used to synchronize the changes between the developers
/coolneng/git-presentation/media/branch/master/assets/remote.png
Remote repositories

Merges

  • The development of the developers has to be combined at some point
  • We can merge a branch on another, importing all the changes that were done
/coolneng/git-presentation/media/branch/master/assets/merge.png
Merging the branches Test and Master

Cheatsheet

  • Add a file to the index
git add file
  • Commit the changes
git commit
  • Change the branch
git checkout branch_name
  • Send the changes to the server
git push
  • Get the changes from the server
git pull