1 / 27

An Introduction to the Git Revision Control System

An Introduction to the Git Revision Control System. Jonathan Adamczewski. This presentation is not One VCS is better than another Me telling you that you should use Git Anyone suggesting that Insomniac will stop using Perforce This presentation is an introduction to Git : How it works

alesia
Download Presentation

An Introduction to the Git Revision Control System

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. An Introduction to theGit Revision Control System Jonathan Adamczewski

  2. This presentation is not • One VCS is better than another • Me telling you that you should use Git • Anyone suggesting that Insomniac will stop using Perforce This presentation is an introduction to Git: • How it works • Ways that it is or isn’t like Perforce

  3. GIT VS PERFORCE FIGHT.

  4. Perforce Git Commit • Submit

  5. Perforce Git Commit (verb) -> Commit (noun) • Submit -> Changelist

  6. Perforce Git Distributed storage Distributed, divergent histories Peer to peer collaboration Central server optional --- • Centralized storage • Centralized history • Centralized collaboration • Connection to server is required • p4 edit

  7. Perforce Git Entire working copy is versioned (snapshots) Every commit has a unique SHA-1 hash from: Parent commit(s) Description Author Content • Files are versioned • Server-wide incrementing changelist number

  8. Perforce Git Every clone of a git repository stores the entire history of the repository • Client view maps file in depots to local files on client system

  9. “A Perforce branch is a branch of file hierarchy. A Git branch is a branch of workspace history.”

  10. Perforce Git Create arbitrary file histories and store them in local branches • One set of local changes per file • No history stored outside of the server

  11. Perforce Git Branching is Very cheap Expressed as a new pointer associated with a single commit Branch cost is constant:One 41 byte file per branch. • Branching • Cost scales with size • Expressed as a duplication and divergence in the file hierarchy • Branch cost depends on the size & number of files being branched

  12. Perforce Git Changing branches usually happens in one working copy git checkout some_branch • Changing branches usually means moving to a different directory cd \core\users\jadamczewski \code

  13. Perforce Git Arbitrary local histories Looks like Nothing quite like pending changelists Modified filesare staged and then committed • One set of local changes per file • Looks like: • File can be in only one pending changelist • Easy to miss files when submitting

  14. With great power comes great blahblablah

  15. Perforce Git Potentially many local changes per file Potentially many resolves per file before submit Not usually that bad git rebase • One set of local changes per file • One resolve per file before submit

  16. Perforce Git Every user’s machine is their git server – not dedicated to just git Not good with large, frequently changing binary files Repo size increases quickly • A mighty server dedicated to storing all the versions of all the files • Handles anything and everything – text, binary, large, small

  17. Perforce Git branch/commit Store a copy in the local repo clone or push(or just copy the repo) Duplicate the [contents of] the repo somewhere else For backup and collaboration Many ways to get commits from another repo • shelve • For backup and collaboration • Stores a copy on the server • Allows local revert without losing changes • Generally inconvenient to move uncommitted changes between branches

  18. Perforce Git stash Just to stash some changes easily of to the side stashed changes are kept in a stack, and can be re-applied later • shelve • Sometimes just to stash some changes easily off to the side

  19. Perforce Git Commit only stores changes on your local HDD Need to push, copy, or otherwise share the commit to have a redundant copy • Submit means there is redundancy – the data exists on your machine and the server.

  20. Git directory structure: repo_dir/ .git/<git’s many files> your workspace

  21. How to commit a file: • Make changes to files in the working directory.Does not require marking for edit.(edit, add, delete, copy, etc) • Stage the files for commit. Does not affect the recorded history for the current branchgit add, gitrm, git mv • Commit the files to the repository.git commit

  22. http://git-scm.com/book/en/Distributed-Git-Distributed-Workflows shows what some real world distributed workflows look like

  23. http://git-scm.com/book/en/Distributed-Git-Maintaining-a-Project has information about maintaining repos in a distributed environment

  24. Some commonly used git commands # reset contents of working dirgit reset # manipulate branches git branch # populate working dir with a commitgit checkout # merge multiple branchesgit merge

  25. # reapply changes to a different # commitgit rebase# rewrite history git rebase –i # stage a file for commitgit add# stage parts of files for commitgit add -i

  26. # show the current state of the # working dir. Lists new and modified # files and files staged for commitgit status # list commits in a branch from the # most recent git log # list files know to git in a branchgitls-files

  27. # search through files known to git – # very fast!gitgrep# show changes between thingsgit diff# get a basic graphical UIgitk# copy commits from one branch to anothergit cherry-pick

More Related