git checkout -b feature_branch develop
git push origin feature_branch
Merge a feture back to develop:
git checkout develop
git merge --no-ff feature_branch
git branch -d feature_branch
git push origin develop
Revert a staged file to unstaged:
git reset HEAD file
Revert all files from staged to unstaged:
git reset HEAD
Clear local (unstaged) changes:
git clear -d -f
git chekcout .
Revert a local commit back to staging:
git reset --soft HEAD~1
git branch -d branch_name
git push origin :branch_name
Move commits to different branch (from develop):
git checkout develop
git branch new_branch
git checkout new_branch
git push --set-upstream origin new_branch
git checkout develop
git reset --hard a1b2c3d4 # to the commit you want
gut push --force
git stash show -p stash@{0}
git remote -v
git remote set-url origin https://github.com/USERNAME/OTHERREPOSITORY.git
git remote -v
git branch -m feature-old feature-new
git push origin :feature-old
git push origin feature-new
git merge --no-ff <branch>
#option 1: merge manually
#option 2: use the changes from the destination branch
git checkout --ours -- <filename>
#option 3: use the changes from the origin branch
git checkout --theirs -- <filename>
# add and commit
git add <filename>
git commit -m "Merge message"
git commit --amend -m "New commit message"
git merge-base --octopus <sha1> <sha1>
Rebase: put a commit between other commits
git checkout <branch>
git checkout <sha1>
git checkout -b <temp>
git add
git commit -m <message>
git rebase <temp> <branch>