Git
1 ) Create new branch
git checkout -b RCOM-605-FatPipe-Rollback
2) Compare the difference of a commit and its ancestor
git diff <commit-id>^!
3) git reset
-- To UNDO local file changes but NOT REMOVE your last commit, then use
git reset --hard
-- To UNDO local file changes AND REMOVE your last commit, then use
git reset --hard HEAD^
or
git reset --hard HEAD~
-- To KEEP local file changes and REMOVE ONLY your last commit, then use
git reset --soft HEAD^
or
git reset --soft HEAD~
4) Git revert
git-revert <commit id>
Revert some existing commits
5) Git push without username and password
git remote set-url origin git@github.com:USERNAME/OTHERREPOSITORY.git
6)
To create a new branch from existing one you first have to checkout new branch locally, then push it to remote so other can see it. Below are the exact commands.
Create new branch from existing branch locally
git checkout -b {NEW_branch_name} {SOURCE_branch_name}
Specifying -b causes a new branch to be created
Push changes to origin
git push origin {NEW_branch_name}