Skip to content

Instantly share code, notes, and snippets.

@islomar
Last active May 9, 2017 15:11
Show Gist options
  • Save islomar/3faf875e84758dbb8f17 to your computer and use it in GitHub Desktop.
Save islomar/3faf875e84758dbb8f17 to your computer and use it in GitHub Desktop.
Git commands and bash
#Great tips
http://firstaidgit.io/#/
#Display all unpushed commits
git log origin/master..HEAD
#GitHub emoji
http://www.emoji-cheat-sheet.com/
#Git flow
http://danielkummer.github.io/git-flow-cheatsheet/
http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/
#Git bash
http://git-scm.com/book/en/v2/Git-in-Other-Environments-Git-in-Bash
Files to be copied are in: https://github.com/git/git/tree/master/contrib/completion
# Git commands
git config --global push.default nothing
git branch -a: muestra ramas remotas
git branch -v
git branch -vv >> to see what is tracking each branch
git remote -v
git checkout -b develop origin/develop: crea la rama y la engancha con el remoto
git reset -soft HEAD^ >> returns to stage the last commit
git gui
gitk origin/master..
git commit --allow-empty -m "Trigger job"
git commit -n >> skip hooks
git push origin
squash: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
git log |grep <commit_id> >> to verify if a specific commit exists in your branch
git diff --stat [remote/branch] >> shows all the differences (in files) with the remote
git log [remote/branch]..HEAD --oneline >> see differences in commits with the remote
git merge-base branch1..branch2 >> shows common ancestor
git log --graph --online --all
git log origin/develop..
#Show all files included in a commit
git show --pretty="format:" --name-only <commit_id>
#Take a quick look at an old revision of a single file
git show commitid:filename
#Recover a deleted branch
http://repo.or.cz/w/git.git/blob/HEAD:/contrib/git-resurrect.sh
git reflog --> git checkout -b <hash>
#Stash
git stash -u >> includes unstaged files in the stash, it leaves it absolutely clean
git stash list
git stash branch <new-branch-name> [stash-id] >> it creates a branch from a stash
git stash save <description>
git stash apply stash@{1}
git stash drop stash@{1}
git stash clear
#Reverts
git reset --soft HEAD~1 >> undo the last commit (not having pushed yet), takes it to stage
#Export/archive
git archive --format zip --output ./poc-angularjs.tar master
# Delete files/folders from history
https://rtyley.github.io/bfg-repo-cleaner/
https://help.github.com/articles/removing-sensitive-data-from-a-repository/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment