pcottle / learnGitBranching

An interactive git visualization and tutorial. Aspiring students of git can use this app to educate and challenge themselves towards mastery of git!
https://pcottle.github.io/learnGitBranching/
MIT License
30.52k stars 5.75k forks source link

feat: command to simulate Merge/Pull Request #1120

Closed Magador closed 9 months ago

Magador commented 9 months ago

Resolves #1057

Examples

Merging a feature branch feat into main on origin

git clone;
git switch -c feat;
git commit;
git push;
git fakeTeamwork;
git mergeMR feat main;

image

Merging a feature branch feat into main on origin when deleting it after merging

git clone;
git switch -c feat;
git commit;
git push;
git fakeTeamwork;
git mergeMR feat main --delete-after-merge;

image

If you git fetch after using git mergeMR, the ref o/feat will still exist because git fetch does not prune it by default:

git fetch;

image

You can re-push the local branch, re-creating a remote branch, and updating the ref o/feat:

git commit;
git push;

image

netlify[bot] commented 9 months ago

Deploy Preview for xenodochial-hugle-b9ec84 ready!

Name Link
Latest commit acffcc1616b896463d226385f9d7f6e756cc88ec
Latest deploy log https://app.netlify.com/sites/xenodochial-hugle-b9ec84/deploys/657c9f925cf72c0008088eba
Deploy Preview https://deploy-preview-1120--xenodochial-hugle-b9ec84.netlify.app/
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

pcottle commented 9 months ago

Wow @Magador I really appreciate the contribution! You wrote tests and explained the small change in the git engine and thought about everything 🙌🏻

I'm not super familiar with these alternate workflows for merging features (at Instagram we all just merge into one main trunk branch) but sounds like you've thought about these a lot. I'll merge and push the site now with the updates 😎

IT-VBFK commented 9 months ago

Yeah :)

thanks @Magador

HenryChan-Git commented 8 months ago

that's good ! Where can i do this experiment ? I do not find this one in https://learngitbranching.js.org/?locale=zh_CN

Magador commented 8 months ago

that's good ! Where can i do this experiment ? I do not find this one in https://learngitbranching.js.org/?locale=zh_CN

You can simulate a merge using the sandbox and creating a remote repo :

git clone;
git switch -c feat;
git commit;
git push;
git fakeTeamwork;
git mergeMR feat main;
HenryChan-Git commented 8 months ago

yes, it works