Skip to content

Instantly share code, notes, and snippets.

@techthoughts2
Last active January 5, 2019 00:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techthoughts2/6c063d87ef3ba0814c8c597b287c05a1 to your computer and use it in GitHub Desktop.
Save techthoughts2/6c063d87ef3ba0814c8c597b287c05a1 to your computer and use it in GitHub Desktop.
Collection of Git Commands
git clone https://repo_address.git
git add .
git add --all
git commit -m "Initial commit"
git push origin master
git pull origin master
git config user.name "Jake"
git init [new repo in dir you are currently in]
git --add file.txt [adds a file that you specify for commit]
git status
git show [info on last commit + diff]
git log [entire log]
git log -1 [specify how many commits back]
git log -1 --pretty=%B [JUST the commit info]
git reset HEAD newfile.txt [unstage a file]
git reset --hard HEAD [lost everything in the current change set]
git rm [careful, will remove (delete) file on next commit]
git rm --cached [remove file from commit but doesn't delete]
git tag -a MyTageName -m "This is my first tag"
git branch
git branch NewWork
git checkout NewWork
git checkout -b pasta [new creation at same time]
git merge NewWork
git diff branchname..branchname
git stash
git remote -v [show remote location]
git fetch vs git pull
git config --global push.default simple
git config --global -l
git mergetool
git config --global credential.helper
git --exec-path
Reset commits
git add --all
git fetch --all
git reset --hard origin/branchname
git branch -d localBranchName [deleting a local branch]
git push origin --delete branchName [deleting a remote branch]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment