Skip to content

A repository that contains life and time saver git commands; rollback, revert, etc. (in-progress)

License

Notifications You must be signed in to change notification settings

MhmtMutlu/life-saver-git-commands

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 

Repository files navigation

Life and Time Saver Git Commands 🚀

A repository that contains life and timer saver git commands; rollback, revert, etc. (in-progress)


How to delete all local git branches?

git branch --list | grep -v 'master' | xargs git branch -D

How to undo the last commit from a remote git repository?

git reset HEAD^
git push origin +HEAD

How to revert merge?

# create new branch for being safe.
git revert -m 1 <MERGE_COMMIT_ID>
git push

How to revert conflicted merge?

git merge --abort

How to Checkout/Update a Single File From Remote Origin Master?

git checkout origin/<branch-name> -- <path-to-file>

How to pick a commit and apply current branch from another branch? (cherry-pick)

git cherry-pick <commit_id>

How to remove untracked files?

git ls-files --others --exclude-standard | xargs rm

How to add a message to stash?

git stash save "Your stash message"

How to bring nth record from the stash list without removing it?

git stash apply {n} # n is optional, from nth history.

How to bring last entry to the stash list and remove?

git stash pop 

How to delete a stash record from the list?

git stash drop 

How to move latest changes to stash with different branch?

git stash branch <new-branch-name>

How to visualize all git logs?

git log --oneline --graph -decorate --all

About

A repository that contains life and time saver git commands; rollback, revert, etc. (in-progress)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published