Skip to content

Instantly share code, notes, and snippets.

@BaerMitUmlaut
Created May 9, 2018 16:47
Show Gist options
  • Save BaerMitUmlaut/43d3dd3a87033fc757dbf75c2f2fe1a7 to your computer and use it in GitHub Desktop.
Save BaerMitUmlaut/43d3dd3a87033fc757dbf75c2f2fe1a7 to your computer and use it in GitHub Desktop.
ezpz git
# Username and e-mail for commits
git config --global user.name "<username>"
git config --global user.email <username>@users.noreply.github.com
# Preferred text editor for small stuff like commit messages, default is vim
# I'd recommend nano since it's easier to use but also runs in the terminal
git config --global core.editor <command>
# Always push current branch, create on remote if not existing yet
git config --global push.default current
# Cloning a repository (target dir is optional, defaults to repo name)
git clone https://github.com/<repo owner>/<repo name>.git <target dir>
# Getting the status of your repo, contains changed, deleted and new files,
# branch name, bunch of other stuff - the most important command!
git status
# Detailed view of all the changes you made
git diff
# List the last commits
git log
# Same thing, just more compact, I can recommend setting this as an alias
git log --pretty=format:"%C(bold red)%h%Creset %C(bold green)%an:%Creset %s"
# Make git track new files and add the listed files to the next commit
git add <filename(s)>
git add --all
git add -A
# Commiting changes
git commit -m "<commit message>"
# Commit all changed files (does not include untracked files!)
git commit -am "<commit message>"
# Push branch to remote
git push
# Get latest changes of remote
git pull
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment