Initiatize a new git repository
$ git init
Get the status of a repository
$ git status
Get git to track changes to a file
$ git add <FILE>
Commit files in the staging area to our repository
$ git commit -m "Adding files to git repo"
See what has changed in a repo
$ git log
Add a remote git repository
$ git remote add origin https://foo/git.git
Push changes to a specific repository and tell git to remember where
$ git push -u origin master
Check for changes on a github repo
$ git pull origin master
Check to see what has changed in a repo
$ git diff HEAD
View the diff from files in the staging ara
$ git diff --staged
Unstage files from the repo
$ git reset foo/bar
Revert a repo to s specific point in time
$ git checkout -- file-from-commit-point
Make a branch to test changes then merge this back into master
$ git branch clean_up
Remove all files in a folder from a repo
$ git rm -r folder_to_remove
Merge changes from a branch back into master first switch to master
$ git checkout master
$ git merge clean_up
Delete an unused branch
$ git branch -d clean_up
Remove a branch that was never merged
$ git branch -D clean_up
Push all local changes to remote repository
$ git push
Show current remote repo
$ git remote -v
Add an upstream repository so changes from the original can be merged into your fork
$ git remote add upstream https://github.com/Matty9191/ssl-cert-check.git
Commits to master will be stored in a local branch, upstream/master#
$ git fetch upstream
Checkout master from upstream into upstream/master
$ git checkout master
Merge upstream w/ the local repository
$ git merge upstream/master
Create and synchronize git repo with github
$ git init
$ git add .
$ git commit -m "Initial commit"
$ git remote add origin https://github.com/Matty9191/tools.git
$ git pull origin master
$ git push -f origin master
Update git repo that was cloned
$ git clone URL
$ git add .
$ git commit -m "Initial commit"
$ git push origin master
- gource can be used to visualize git repositories
- myrepos can be used to manage git repositories
- vcsh can be used to version control home directory
THIS INFORMATION IS PROVIDED UNDER A GPLV2 LICENSE
THE GPLV2 LICENSE CAN BE VIEWED HERE