0% found this document useful (0 votes)
5 views

Git - Useful Commands

Uploaded by

vishwasransing
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Git - Useful Commands

Uploaded by

vishwasransing
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

- git stash - temporarily save changes without committing

- Switching branches without committing


- git stash pop -> Recover the stashed changes to working dir
- git stash apply -> Reapply
- Recover stash using:
- git stash list
- git stash apply stash@{index}
- git reset hard <commit hash> -> Will revert back to the progress of mentioned
hash

- git checkout --orphan frontend-dev-vishwas -> Will create a new branch with no
commit history

- git rm -rf . -> Remove all files from the current branch

- git add . -> Add all files to the branch

- git commit -m "custom message"

- git push origin branch_name

- git branch

- git checkout branch_name

- git checkout new_branch_name

- Git Vim editor:


To exit the Git Bash commit edit message:
- If you’re in Vim (the default editor):
- Press Esc to enter command mode.
- Type :wq (write and quit).
- Press Enter.
- If you want to discard the commit message:
- Press Esc.
- Type :q! (quit without saving).
- Press Enter.

- git reset node_modules/ -> Will reset the added files from node_modules
folder
- Renaming:
- git branch -m old_name new_name
- git push origin new_name
- git push origin --delete old_name
- git branch --set-upstream-to=origin/new_name
- Cloning particular branch:
- git clone --branch feature-dev-vishwas
https://github.com/impritichouhan/mycards-ui.git

You might also like