|
Introduction
|
Git version control records text-based differences between files.
Each git commit records a change relative to the previous state of the documents.
Git has a range of functionality that allows users to manage the changes they make.
This complex functionality is especially useful when collaborating on projects with others
|
|
Forks
|
|
|
Branches
|
A branch represents an independent line of development.
git branch creates a new pointer to the current state of the repository and allows you to make subsequent changes from that state.
Subsequent changes are considered to belong to that branch.
The final commit on a given branch is its HEAD.
|
|
Remote Repositories
|
The git remote command allows us to create, view and delete connections to other repositories.
Remote connections are like bookmarks to other repositories.
Other git commands (git fetch, git push, git pull) use these bookmarks to carry out their syncing responsibilities.
|
|
Branching Models
|
|
|
Merging
|
|
|
Advanced Logging
|
|
|
Identifying breaking commits
|
|
|
Undoing Changes
|
git revert undoes a commit by creating a new commit.
git revert should be used to undo changes on a public branch or changes that have already been pushed remotely.
git revert only backs out a single commit or a range of commits.
git reset rolls back the commits and leaves the changes in the files
git reset --hard roll back and delete all changes
git reset alters the history of the project.
You should use git reset to undo local changes that have not been pushed to a remote repository.
git restore can restore a file in the working directory to it’s state from the repository.
git restore --staged can remove a file from the staging area but leaves it in the working directory.
git restore is a newer command and git reset can be used to do many of the same operations, but git restore has a simpler syntax.
git checkout <commit ID> can be used to move the repository back to an earlier commit.
git checkout <commit ID> -- <filename> can restore an individual file from an earlier commit
|
|
Tags
|
|
|
Issue Tracking
|
Github includes an issue tracker for each repository where people can describe and discuss issues with code.
Issues can be opened, commented on and closed from the Github web interface.
Issues can also be closed in a commit message using ‘fixes’, ‘fixed’, ‘close’, ‘closed’ or ‘closes’ followed by a # symbol and the issue number.
|
|
Using Large Files in Git
|
(Large) binary files can grow the repository size immensely and make it unusable
git lfs is an extension that stores large files outside the Git data model
Use of Git LFS is discouraged in many scenarios.
|
|
Publishing and Citing Code
|
|