Created
February 28, 2020 21:27
-
-
Save donkirkby/fedd09548a9e596f94a203e9ec48cf91 to your computer and use it in GitHub Desktop.
Dirty Master git tutorial
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"goalTreeString": "{\"branches\":{\"master\":{\"target\":\"C2\",\"id\":\"master\",\"remoteTrackingBranchID\":\"o/master\"},\"o/master\":{\"target\":\"C2\",\"id\":\"o/master\",\"remoteTrackingBranchID\":null},\"my-stuff\":{\"target\":\"C3\",\"id\":\"my-stuff\",\"remoteTrackingBranchID\":\"o/my-stuff\"},\"o/my-stuff\":{\"target\":\"C3\",\"id\":\"o/my-stuff\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C3\":{\"parents\":[\"C1\"],\"id\":\"C3\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"}},\"tags\":{},\"HEAD\":{\"target\":\"my-stuff\",\"id\":\"HEAD\"},\"originTree\":{\"branches\":{\"master\":{\"target\":\"C2\",\"id\":\"master\",\"remoteTrackingBranchID\":null},\"my-stuff\":{\"target\":\"C3\",\"id\":\"my-stuff\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C1\"],\"id\":\"C3\"}},\"tags\":{},\"HEAD\":{\"target\":\"master\",\"id\":\"HEAD\"}}}", | |
"solutionCommand": "git branch my-stuff;git fetch origin;git reset --hard o/master;git checkout my-stuff;git push", | |
"hint": { | |
"en_US": "git reset --hard o/master" | |
}, | |
"name": { | |
"en_US": "Dirty Master" | |
}, | |
"startTree": "{\"branches\":{\"master\":{\"target\":\"C3\",\"id\":\"master\",\"remoteTrackingBranchID\":\"o/master\"},\"o/master\":{\"target\":\"C1\",\"id\":\"o/master\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C3\":{\"parents\":[\"C1\"],\"id\":\"C3\"}},\"tags\":{},\"HEAD\":{\"target\":\"master\",\"id\":\"HEAD\"},\"originTree\":{\"branches\":{\"master\":{\"target\":\"C2\",\"id\":\"master\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"}},\"tags\":{},\"HEAD\":{\"target\":\"master\",\"id\":\"HEAD\"}}}", | |
"startDialog": { | |
"en_US": { | |
"childViews": [ | |
{ | |
"type": "ModalAlert", | |
"options": { | |
"markdowns": [ | |
"## Move Your Commit", | |
"Oh no! You've accidentally committed to your local `master` branch. Practice moving that commit to a feature branch, and pushing that branch to the remote repository.", | |
"", | |
"One glitch in this sandbox: use `o/master` where you would normally use `origin/master`.", | |
"" | |
] | |
} | |
} | |
] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a git visualization demo for how to recover from accidentally commiting to
master
on a project that protects themaster
branch. Se it in action at learngitbranching.js.org.