git checkout -b contact-form(do your work on "contact-form")git statusgit commit -am "updated form in contact module"git checkout mastergit merge --no-ff contact-formgit branch -d contact-formgit push origin master
下面:实际用法,包括解释。 注意:下面的输出被剪切;git非常冗长。
$ git status# On branch master# Changed but not updated:# (use "git add/rm <file>..." to update what will be committed)# (use "git checkout -- <file>..." to discard changes in working directory)## modified: ecc/Desktop.php# modified: ecc/Mobile.php# deleted: ecc/ecc-config.php# modified: ecc/readme.txt# modified: ecc/test.php# deleted: passthru-adapter.igs# deleted: shop/mickey/index.php## Untracked files:# (use "git add <file>..." to include in what will be committed)## ecc/upgrade.php# ecc/webgility-config.php# ecc/webgility-config.php.bak# ecc/webgility-magento.php
$ git checkout -b NewFeature[work...work...work][New changes made for HotFix in the main branch! Lets get them...]$ git commit -am "New feature in progress"$ git pull origin main[shortcut for "git fetch origin main", "git merge origin main"]