git remote rm <destination>
Use these commands if you made any mistakes. Accidental commits, wrong git message (or typo).
git commit --amend
orgit commit --amend -m "New git message"
git reset --soft HEAD~1
(make sure working directory is clean: use git stash)
Git stash is a way to temporarily save your work without committing. This is helpful when you're in a middle of changes but you want to switch branch or maybe after doing some work you realised that you were in the wrong branch.
git stash save "<Save name>"
git stash save "<Save name> -u"
git stash list
It will show something like this
stash@{0}: WIP on submit: 6ebd0e2... Update git-stash documentation
stash@{1}: On master: 9cc0589... Add git-stash
- Apply stash but won't drop it
- n = stash index
git stash apply stash@{n}
- Apply stash and drop it
- It will apply and drop
stash@{0}
everytime git stash pop
- n = stash index
git stash drop stash@{n}
git stash clear
git fetch upstream
to get latest changes from original repogit merge upstream/<branch-name> origin/<branc-name>
merge with local repo