Overview of Git
-
Git is a version control tool
-
Allows us to track and undo changes to files on a project
-
Allows us to easily share code with others
-
Allows us to make local edits without affecting collaborators
Git "places"
-
Remote repository
-
"Official" copy of files and their edit history; accessible to others
-
-
Local repository
-
Your personal copy of the files and their edit history
-
-
Working directory
-
Where you can make changes to files; no edit history here
-
-
Staging area
-
Where you take snapshots of edits to go into the local repository
-
Some Git commands
-
git clone-
Make a local repository from a remote repository
-
-
git add-
Stage a file for commit
-
-
git commit-
Commit staged changes to the local repository
-
-
git push-
Send commits from the local repository to the remote repository
-
-
git fetch-
Pull commits from the remote repository to the local repository
-
-
git merge-
Reconcile
fetched changes with the current state of files in your working directory
-
-
git pull-
Do
fetchandmergein a single step
-
Git commands, illustrated
Let’s see some Git in action
Summary
-
Git is a version control system
-
Git "places" include the remote repository, the local repository, the working directory, and the staging area
-
Git commands include clone, add, commit, push, fetch, merge, and pull