develop process

-f Option is dangerous, make sure that only do this on your own branch

# When you starting coding at the first time, create a new branch which track the develop:
$ git fetch
$ git checkout -t origin/develop -b whatsThisBranchFor

# Coding...
$ git add && git commit
$ git pull --rebase

# Coding...
# Fetch new code on origin/develop in the middle
$ git stash
$ git pull --rebase
$ git stash pop

# Coding...
$ git add && git commit
$ git pull --rebase

# ...

$ git push origin whatsThisBranchFor -f




When you want to do some minor changes in your existing commit, please re-commit with git commit --amend,

$ git log
commit 1 # Which you want to change
commit 2

# Coding...
$ git status
files1 changes
files2 changes

$ git add files1
$ git commit --amend
# It will show "commit 1" in the editor, you can re-edit the message to "commit 1 new" if necessary, then save, exit
$ git log
commit 1 new # New changes of files1 has been included
commit 2

# As you changes the commit, Git will warn you that the remote branch is diverged from your local one,
# use '-f' option to force update, make sure that only do this on your own branch.
$ git push origin whatsThisBranchFor -f
原文地址:https://www.cnblogs.com/Brittany-yan/p/5549497.html