I am working on a PHP web application and some times I would like to just fix a bug or add new feature and test it, before merging with the master branch. My understanding is that Git doesn’t create a physical folder for a branch, but only stores it in .git folder. So how can I test like opening a url in the browser i.e. http://localhost/test/index.php, and if it’s working fine, only then merge it with the master branch?
Share
Just use
git checkout yourbranch, test your feature, thengit checkout masterand merge it if you want.If
git checkoutcomplains about local changes, usegit stash.The man pages are clear about that, and very helpful, I recommend you read them.
Another way of doing it is to merge the branch immediately, and if you are not happy with it, just use
git reset --hard ORIG_HEAD. This will effectively undo the merge commit.