IskandarG IskandarG - 1 year ago 91
Git Question

Testing latest code on Git remote master branch before merging

I have a few commits already but someone pushed some changes on the master branch and I would like to play it safe by checking out and test the changes before merging it into my local master branch. How do I achieve this ?

Answer Source

you can fetch the remote branch which you can reference using FETCH_HEAD and then checkout that branch.

git fetch remote_branch

git checkout FETCH_HEAD

this will put you in detached state but if you just want to temporarily test these changes this is fine.

and after you are done testing you can merge back it to your branch.

git checkout your_prevous_branch

git merge FETCH_HEAD

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download