Code Monkey home page Code Monkey logo

life-saver-git-commands's Introduction

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 Git cherry-pick only changes to certain files?

# cherry-pick -n (--no-commit) which lets you inspect (and modify) the result before committing.
git cherry-pick -n <commit>

# unstage everything
git reset HEAD

# stage the modifications you do want
git add <path>

# make the work tree match the index
# (do this from the top level of the repo)
git checkout .

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

life-saver-git-commands's People

Contributors

emreyildirim53 avatar mhmtmutlu avatar yusufyilmazfr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.