// See branchs
git branch
// Create a branch and checkout it.
git checkout -b hotfix
// This is shorthand for :
// git branch hotfix
// git checkout hotfix
// Delete branch
git branch -d hotfix
// Delete remote branch
git push origin --delete hotfix
// Push branch to remote server
git push --set-upstream origin hotfix
// Merge
git merge hotfix
// You can merge branch by follows if error [fatal: refusing to merge unrelated histories] occurred.
git merge develop --allow-unrelated-histories
// http://stackoverflow.com/questions/37937984/git-refusing-to-merge-unrelated-histories
// See stutas if conflicts occurred
git status
// Merge files
// https://git-for-windows.github.io/
// http://stackoverflow.com/questions/426026/git-on-windows-how-do-you-set-up-a-mergetool
git mergetool
git commit -m 'merge finished'
// edit file directly
git add .
git commit -m 'merge finished'
// Cancel last commit
// http://stackoverflow.com/questions/927358/how-to-undo-last-commits-in-git
git reset HEAD~
// Undo cancel last commit
// http://stackoverflow.com/questions/5473/how-can-i-undo-git-reset-hard-head1
git reflog
git reset --hard <id>
// Discrad all changes
// http://stackoverflow.com/questions/1090309/git-undo-all-working-dir-changes-including-new-files
git reset --hard
// Discrad all change (include untracked files)
// http://stackoverflow.com/questions/14075581/git-undo-all-uncommitted-changes
git clean -fdx
// Change last commit message
// http://stackoverflow.com/questions/179123/how-to-modify-existing-unpushed-commits
git commit --amend -m "New commit message"
Comments
Leave a comment