Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // force push
- git push --force
- //Identify merged branches
- git branch --merged
- git branch --no-merged
- //Delete local Branches
- git branch -d branchname
- //delete remote branch
- git push origin :namebranch
- // reset to commit ()
- git reset --hard shacode
- //Create tag
- git tag -am "Description" nametag shacode
- //list tags
- git tag -l
- git tag -n v*
- git tag -l -n
- // go to this tag
- git checkout tagname
- //To push a single tag
- git push origin <tag_name>
- //Push all tags
- git push --tags
- // Fetch tags
- git fetch --tags
- // go to interactive mode
- git add -i
- // Do cherry pick
- git cherry-pick
- // solver merged pick
- git add .
- git cherry-pick --continue
- //
- git checkout -- finemaestaged
- //patches -> past changes without commit
- git diff onebeforeinitialcommitsha..lastcommitsha > filename.diff
- //apply patch
- git apply filename.diff
- //format patch
- git format-patch onebeforeinitialcommitsha..lastcommitsha > directory
- //apply format patch
- git am filename.patch
- git am <directory>/filename.patch
- // REBASE: Manage and incorporate changes between new branches
- // Useful to integrate recent commits without merging
- // Put branch at the end of other branch
- // Rebase current branch at the end of master
- git rebase master
- // Rebase new_feature branch at the end of master
- git rebase master new_feature
- // usefu for visualizing branches
- git log --graph --all --decorate --oneline
- // Return commit where topic branch diverges
- git merge-base master new_feature
- /// Resolver rebase confict
- // solve the merge and execute
- git add filename
- git rebase --continue
- // if you want to skip this patch
- git rebase --skip
- // if you want to abort
- git rebase --abort
- ///rebase onto other branches
- // syntax => git rebase --onto newbase upstream branch
- // example: rebase new feature branch of ecommerce branche onto master
- git rebase --onto master ecommerce new_feature
- // Undo rebase: can only for simple rebases(they are destructives)
- git reset --hard ORIG_HEAD
- // interactive Rebase: Rebase new_feature to master branch
- git rebase -i master new_feature
- /// Rebase last 3 commits onto the same branch but with the opportunity to modify them
- git rebase -i HEAD~3 //also used for clean small commit about the same thing
- // If appear the interactive file, first select pick, second squash, thirt fixup
- // pull rebase: Fetch and rebase, only use it for local branches
- git pull --rebase
- git pull -r
- git pull --rebase=preserve // preserve locally commit merge created
- git pull --rebase=interactive
- ///Logs
- //List commits as patches
- git log -p
- git log --patch
- //List edits to lines 100-150 in filename.txt
- git log -L 100,150:filename.txt
- // after git log -> find a word use '/word' and if you want to see next occurrence press 'n', previus ocurrence 'N'
- /// Blame
- // Annotate file with commit details
- git blame filename.txt
- // Ignore whitespaces
- git blame -w filename.txt
- // Annotate lines
- git blame -L 100,150:filename.txt
- git blame -L 100,+5:filename.txt
- // Annotate file at revision d9dba0
- git blame d9dba0 filename.txt
- git blame -- d9dba0 filename.txt
- // Add global alias for 'praise'
- git config --blobal alias.praise blame
- // Similar to blame, different output
- git annotate filename.txt
- // Bisect: Find the commit that introduced a bug or regression
- git bisect start
- git bisect bad <sha> // is not specify sha, will be last commit
- git bisect good <sha>
- git bisect reset
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement