02-05-2021



Sheet

A quick reference to Git.

Git status; Make smallest possible change to add or improve something; review git status, git diff; Add files to commit git add, git status; Commit changes git commit, git status; Push changes to GitHub fork git push origin master. Git branch -a: List all branches (local and remote) git branch branch name Create a new branch: git branch -d branch name Delete a branch: git push origin -delete branch name Delete a remote branch: git checkout -b branch name Create a new branch and switch to it: git checkout -b branch name origin/branch name Clone a remote branch. GitHub: A cheat sheet by Jack Wallen in Developer on September 22, 2020, 7:44 AM PST GitHub is a code housing platform that allows developers to store their projects and network with peers.

Git Cheat Sheets. Reference sheets covering Git commands, features, SVN migrations, and bash. Available in multiple languages.

Created on: 2019-03-19

Tag: cheat_sheet

Warning

under heavy construction and not well organized

(source: https://stackoverflow.com/a/3596272/5350059)

::
Cheat

git -C $dir_path rev-parse

(source: https://stackoverflow.com/a/39518382/5350059)

(source: https://stackoverflow.com/a/2596835/5350059)

(source: https://stackoverflow.com/a/23134785/5350059)

(source: https://stackoverflow.com/a/8943761/5350059)

(source: https://stackoverflow.com/a/46798693/5350059)

change proxyuser to your proxy userchange proxypwd to your proxy passwordchange proxy.server.com to the URL of your proxy serverchange 8080 to the proxy port configured on your proxy server

to get current proxy settings:

to unset proxy:

Github git cheat sheet template

(source: https://stackoverflow.com/a/19213999)

to change the author info ie. name and email we need to use the git fil command. First save the following to a file.:

We will save this in a file named filter_author_info.sh. We need the modify the OLD_EMAIL, CORRECT_NAME, and CORRECT_EMAIL to the match our expectation. Now we will change the file permission and run the script:

Next we will review the new Git history for errors. Push the corrected history to remote repo:

And we are done.

(source: https://help.github.com/en/articles/changing-author-info)

to set a custom commit message template:

(source: https://stackoverflow.com/a/28948582/5350059)

to rename a local branch:

(source: https://stackoverflow.com/a/6591218/5350059)

Git command cheat sheetCheat

we can hide out email address from commit log by using the GitHub provided email address:

source: https://help.github.com/en/articles/setting-your-commit-email-address

to undo last commit:

Github Tutorial For Beginners Pdf

Then update remote:

source: https://stackoverflow.com/a/927386/5350059

to generate patch and save it on a file:

source: https://stackoverflow.com/a/44950939/5350059

to apply that patch file:

Github Cheat Sheet Pdf

source: https://stackoverflow.com/a/2250170/5350059

to exclude files from git diff:

for branch:

s: https://stackoverflow.com/a/48651201/5350059

unfortunately there is no way to speed up git clone like make -j but we can do a shallow clone:

If we want the full clone just do:

Github Commands Cheat Sheet

to GPG sign old commits:

Github Git Cheat Sheet

source: https://superuser.com/a/1123928