-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path1ba3b2e6.4db932d1.js
1 lines (1 loc) · 8.64 KB
/
1ba3b2e6.4db932d1.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[6],{138:function(e,t,a){"use strict";a.r(t),a.d(t,"frontMatter",(function(){return o})),a.d(t,"metadata",(function(){return c})),a.d(t,"rightToc",(function(){return l})),a.d(t,"default",(function(){return b}));var n=a(2),r=a(9),i=(a(0),a(163)),o={id:"edit-tutorial",title:"Editing a Tutorial",sidebar_label:"Editing a Tutorial"},c={id:"edit-tutorial",title:"Editing a Tutorial",description:"Once you've created a tutorial, you'll need a way to version and update new releases.",source:"@site/docs/edit-tutorial.md",permalink:"/docs/edit-tutorial",editUrl:"https://github.com/coderoad/coderoad-vscode/edit/master/docs/docs/edit-tutorial.md",sidebar_label:"Editing a Tutorial",sidebar:"someSidebar",previous:{title:"Test Examples",permalink:"/docs/test-examples"},next:{title:"Examples",permalink:"/docs/examples"}},l=[{value:"1. Editing Markdown",id:"1-editing-markdown",children:[]},{value:"2. Editing Git Commits",id:"2-editing-git-commits",children:[]},{value:"Editing A Commit",id:"editing-a-commit",children:[]},{value:"Adding Additional Commits",id:"adding-additional-commits",children:[]},{value:"Rewording a Commit",id:"rewording-a-commit",children:[]},{value:"Oops! Something Went Wrong",id:"oops-something-went-wrong",children:[]}],d={rightToc:l};function b(e){var t=e.components,a=Object(r.a)(e,["components"]);return Object(i.b)("wrapper",Object(n.a)({},d,a,{components:t,mdxType:"MDXLayout"}),Object(i.b)("p",null,"Once you've created a tutorial, you'll need a way to version and update new releases."),Object(i.b)("p",null,"Tutorials are made of two parts: Markdown & Git commits."),Object(i.b)("h3",{id:"1-editing-markdown"},"1. Editing Markdown"),Object(i.b)("p",null,"When editing markdown, simply edit the markdown and re-run the builder."),Object(i.b)("h3",{id:"2-editing-git-commits"},"2. Editing Git Commits"),Object(i.b)("p",null,'Editing Git commits is a bit harder, and involves a part of Git called an "interactive rebase".'),Object(i.b)("ol",null,Object(i.b)("li",{parentName:"ol"},'Create a new branch and give it a versioned named, like "v0.2". It\'s important to create a new branch as we will be changing the git commit history.')),Object(i.b)("pre",null,Object(i.b)("code",Object(n.a)({parentName:"pre"},{className:"language-shell"}),"git checkout -b v0.2\n")),Object(i.b)("ol",{start:2},Object(i.b)("li",{parentName:"ol"},"Start an interactive rebase.")),Object(i.b)("p",null,"When editing code, you'll need to rebase. You can use VSCode as your default editor for Git: ",Object(i.b)("a",Object(n.a)({parentName:"p"},{href:"https://blog.soltysiak.it/en/2017/01/set-visual-studio-code-as-default-git-editor-and-diff-tool/."}),"https://blog.soltysiak.it/en/2017/01/set-visual-studio-code-as-default-git-editor-and-diff-tool/.")),Object(i.b)("p",null,"Run rebase starting at a commit target, or just from the start with ",Object(i.b)("inlineCode",{parentName:"p"},"--root"),"."),Object(i.b)("pre",null,Object(i.b)("code",Object(n.a)({parentName:"pre"},{className:"language-shell"}),"git rebase -i --root\n")),Object(i.b)("h3",{id:"editing-a-commit"},"Editing A Commit"),Object(i.b)("p",null,"Choose the commit you want to edit"),Object(i.b)("pre",null,Object(i.b)("code",Object(n.a)({parentName:"pre"},{className:"language-text"}),"pick b73feaf INIT\npick 0a3aa83 1.1\npick 0d67935 2.1\n")),Object(i.b)("p",null,"Let's say we want to edit step ",Object(i.b)("inlineCode",{parentName:"p"},"1.1"),' Change the word pick to "edit" or "e"'),Object(i.b)("pre",null,Object(i.b)("code",Object(n.a)({parentName:"pre"},{className:"language-text"}),"e 0a3aa83 1.1\n")),Object(i.b)("p",null,'Save the modified rebase summary file and your rebase will start. Git will run through the commits until the first flagged "edit", then stop at the commit.'),Object(i.b)("p",null,'Make the file changes you planned, then "add" your changes to git.'),Object(i.b)("p",null,"To complete rebasing:"),Object(i.b)("pre",null,Object(i.b)("code",Object(n.a)({parentName:"pre"},{className:"language-shell"}),"git rebase --continue\n")),Object(i.b)("p",null,"If you encounter any merge conflicts along the way, resolve them, add the changes and continue as above."),Object(i.b)("h3",{id:"adding-additional-commits"},"Adding Additional Commits"),Object(i.b)("p",null,"Let's say we wanted to add an additional commit after the ",Object(i.b)("inlineCode",{parentName:"p"},"1.1"),"."),Object(i.b)("pre",null,Object(i.b)("code",Object(n.a)({parentName:"pre"},{className:"language-text"}),"pick b73feaf INIT\npick 0a3aa83 1.1\npick 0d67935 2.1\n")),Object(i.b)("p",null,'To cause the rebase to pause after a commit, use the word "break" or "b".'),Object(i.b)("pre",null,Object(i.b)("code",Object(n.a)({parentName:"pre"},{className:"language-text"}),"pick b73feaf INIT\npick 0a3aa83 1.1\nbreak\npick 0d67935 2.1\n")),Object(i.b)("p",null,'Save the rebase summary file to start the process. The process should stop at the "break".'),Object(i.b)("p",null,"Add the commits you want, and when you finish continue:"),Object(i.b)("pre",null,Object(i.b)("code",Object(n.a)({parentName:"pre"},{className:"language-shell"}),"git rebase --continue\n")),Object(i.b)("p",null,'If you encounter any merge conflicts along the way, resolve them, add the changes and continue as documented in the "editing a commit" section.'),Object(i.b)("h3",{id:"rewording-a-commit"},"Rewording a Commit"),Object(i.b)("p",null,'Let\'s say we wanted to change the title of commit "2.1" to "1.2".'),Object(i.b)("pre",null,Object(i.b)("code",Object(n.a)({parentName:"pre"},{className:"language-text"}),"pick b73feaf INIT\npick 0a3aa83 1.1\npick 0d67935 2.1\n")),Object(i.b)("p",null,'You can use the "reword" or "r" method.'),Object(i.b)("pre",null,Object(i.b)("code",Object(n.a)({parentName:"pre"},{className:"language-text"}),"pick b73feaf INIT\npick 0a3aa83 1.1\nreword 0d67935 2.1\n")),Object(i.b)("p",null,"When you're finished, just save the file and the commits will be updated."),Object(i.b)("h3",{id:"oops-something-went-wrong"},"Oops! Something Went Wrong"),Object(i.b)("p",null,"Rebasing is a difficult skill to master, but you can get good at it with time. That said, time travelling is a complicated process and a lot can go wrong."),Object(i.b)("p",null,"If something goes wrong during your rebase, you can abort by running:"),Object(i.b)("pre",null,Object(i.b)("code",Object(n.a)({parentName:"pre"},{className:"language-shell"}),"git rebase --abort\n")),Object(i.b)("p",null,"It's best to only run rebase on new branches so that you'll always be able to get back to your last working version."))}b.isMDXComponent=!0},163:function(e,t,a){"use strict";a.d(t,"a",(function(){return s})),a.d(t,"b",(function(){return m}));var n=a(0),r=a.n(n);function i(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function c(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?o(Object(a),!0).forEach((function(t){i(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function l(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)a=i[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)a=i[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var d=r.a.createContext({}),b=function(e){var t=r.a.useContext(d),a=t;return e&&(a="function"==typeof e?e(t):c({},t,{},e)),a},s=function(e){var t=b(e.components);return r.a.createElement(d.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.a.createElement(r.a.Fragment,{},t)}},p=Object(n.forwardRef)((function(e,t){var a=e.components,n=e.mdxType,i=e.originalType,o=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),s=b(a),p=n,m=s["".concat(o,".").concat(p)]||s[p]||u[p]||i;return a?r.a.createElement(m,c({ref:t},d,{components:a})):r.a.createElement(m,c({ref:t},d))}));function m(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=a.length,o=new Array(i);o[0]=p;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:n,o[1]=c;for(var d=2;d<i;d++)o[d]=a[d];return r.a.createElement.apply(null,o)}return r.a.createElement.apply(null,a)}p.displayName="MDXCreateElement"}}]);