src: http://stackoverflow.com/questions/12481639/remove-files-from-git-commit
moving the mistakenly committed files back to the staging area from the previous commit, without cancelling the changes done to them:
git reset --soft HEAD^
or:
git reset --soft HEAD~1
then:
git reset HEAD path/to/unwanted_file
finally re-use same commit msg:
git commit -c ORIG_HEAD
src: http://stackoverflow.com/questions/10827160/undo-a-git-stash
git stash apply --index
src: https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages
rebase last 3 commits:
git rebase -i HEAD~3
Show what will be deleted with the -n option:
git clean -f -n
Then - beware: this will delete files - run:
git clean -f
instead of ammending, one can do this:
git reset --soft @~
and then add the modified files, and create the commit again:
git commit -c ORIG_HEAD
git reset --soft @~
- format VCS changed code in IDE
- git add <modified files>
git commit -c ORIG_HEAD
git fetch upstream pull/1836/head:pr-1836
- use
origin
instead ofupstream
when you are not working with a fork
- use
git checkout pr-1836
git update-index --assume-unchanged .idea/encodings.xml
git checkout *filename*
git remote add origin https://github.com/user/repo.git
# Set a new remote
git remote -v
# Verify new remote
origin https://github.com/user/repo.git (fetch)
origin https://github.com/user/repo.git (push)
in feature branch:
git fetch origin develop
git merge FETCH_HEAD
git commit
git push origin HEAD
generate: git format-patch -1 <sha>
apply: git apply <file.patch>