Last active
August 27, 2019 15:25
-
-
Save tye-shutty/36120c95d3af84ef8627f0e85d232c73 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git stash | |
# saves and removes staged changes | |
git stash list | |
#shows stashes | |
git stash apply <optional stash id, eg stash@{2}> | |
git stash pop | |
#applies most recent stash and deletes it | |
git stash drop <optional stash id> | |
git tag –l | |
#Lists all the tags (versions) | |
git checkout tags/<tag_name> | |
#To switch to that version | |
git checkout - | |
#switches to previous version checkedout | |
git checkout master | |
#switches to most recent version | |
git checkout -b B <sha1 id of the commit B> | |
#-b creates new branch with B name at this commit | |
git rebase --no-ff HEAD~1 | |
git checkout master | |
git merge B | |
#sequence to merge an old commit back into head | |
git clean -f | |
#removes never staged files | |
git checkout -- . | |
#reverts unstaged changes in staged files to last commit | |
git reset --hard <commit id> | |
#resets to commit | |
git push --force origin master | |
#Resets origin to local commit | |
git fetch origin | |
git reset --hard origin/master | |
#resets local to remote | |
reporting-pub tshutty$ git branch --list -a "*m*" --contains 85ce0f96b9cc3dd244ecd57ae99c6715d15e7009 | |
#lists local and remote branches that start with m (includes the remote repo name) and contain this commit | |
#--no-contains is opposite | |
--merged gets branches that have been completely merged into this commit (or HEAD if none specified) | |
##pushing will send the branch you are on to the branch you specify in the remote, if it doesn't exit it will be created. | |
git branch <branch> -d | |
#deletes branch | |
git branch -m <nameold> <namenew> | |
#renames branch | |
git diff | |
#shows unstaged changes | |
git diff --cached | |
#shows staged changes | |
git diff HEAD | |
#shows staged and unstaged changes | |
##squashing commits: | |
git reset --hard <commit id from before your changes> | |
git merge --squash HEAD@{1} | |
#there may be better ways: | |
git reset --soft HEAD~2 && git commit -m "message" | |
#combines last two commits | |
git cherry-pick <commitID> | |
#merges that commit into current branch | |
git checkout <commitID> -- file1/to/restore file2/to/restore | |
#restores specific files to commit | |
git diff branch_1..branch_2 <file> | |
#three dots for change in branch_2 from where it diverged from branch_1 | |
git log -S "1.1.0-SNAPSHOT" | |
#finds when that was created/destroyed | |
##for serenova PR webhook type this comment to retest in jenkins | |
retest this please | |
basename -s .git `git config --get remote.origin.url` | |
#shows name of project | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment