Git reset
Some times we made many commit during PR , we want to combine them to one commit
We can see, I create 4 commits totally.
1 backup the branch to remember the commit ID , in case that you did something wrong , you can roll-back.
$ git branch APPSOL-121312_local
2 git branch -v . check the commit ID , the new branch has the same ID (b103a.....)
3 git reset --soft commit ID( this commit ID is the one before your change, please check the first picture, 819f7 is checkout from master branch).
This command make all of your change combine together, and re-build a new commit ID.
4 git status and git add ** and git diff --cached to see the change.
5 git commit -m " massage"
6 git push --force . (you must use --force) , other wise ,it will ask you to pull firstly. that will lead to conflict.
Q : Why the command is : git ci , git lg ?
add this file's info to your file . PATH is ~/.gitconfig . Modify the email and name to yourself.
GIT Rebase :
1 backup the branch to remember the commit ID , in case that you did something wrong , you can roll-back.
`git branch yourBranch_local`
2 checkout to master branch to pull the latest code
3 checkout to target branch to reset code.
4 backup the branch again to remember the commit ID ,in case that you did something wrong or meet conflict, you can roll-back.
5 rebase
To see all the code change you did
`git diff --cached `
before rebase , you should commit it.
`git commit -m " APPSOL-**** info "`
rebase :
git rebase master
to push the code.
`git push --force`