Introduction to Git
What is Git?
Git is an open source, distributed version control system designed for speed and efficiency.
Git is an open source, distributed version control system designed for speed and efficiency.
What does this mean?
- Everything is local
- Everything is fast
- Every clone is a backup
- Work offline
- Everything is local
- Everything is fast
- Every clone is a backup
- Work offline
No network required
- Commit changes
- View file history
- Perform a diff
- Merge branches
- Obtain other revisions of a file
Git at a high-level
- Git takes a snapshot of what your files look like at a given point in time
- You decide when to take a snapshot and which files to include
- You have the ability to go back in time and review previous snapshots
What is a repository?
- Often shorted to 'repo'
- A collection of all files and their history
- Exists on a local machine or remote server
- The act of copying a repo is called cloning
- Downloading changes is called pulling
- Uploading local changes is called pushing
What is a commit?
- The act of creating a snapshot
- Records changes in a repository
- Contains author, message, and timestamp
- Can be a noun or a verb
- A project is made up of many commits
- Identified by a SHA-1 hash
Git commands
- add
- apply
- bisect
- blame
- branch
- checkout
- cherry-pick
- clean
- clone
- commit
- config
- describe
- diff
- fetch
- grep
- help
- init
- log
- merge
- mv
- pull
- push
- rebase
- reflog
- remote
- reset
- revert
- rm
- show
- stash
- status
- submodule
- tag
- add
- apply
- bisect
- blame
- branch
- checkout
- cherry-pick
- clean
- clone
- commit
- config
- describe
- diff
- fetch
- grep
- help
- init
- log
- merge
- mv
- pull
- push
- rebase
- reflog
- remote
- reset
- revert
- rm
- show
- stash
- status
- submodule
- tag
Demo
https://github.comcast.com/BSD-Digital/git-workshop
Practical Git tips
- Commit early and often
- Keep messages short and descriptive
- Use the imperative mood
- Branch freely
- Pull frequently
- Use aliases for common commands
That's all, folks!
(for now ;)
Introduction to Git
By webguyian
Introduction to Git
An introduction to the Git version control system
- 345