Then, commit the changes to the repository. Interests Computers Mathematics Typography Return to about page Create the file about/me.html with the followingĬontents: About Me About Me I'm a big nerd. With our news hotfix out of the way, we can now continue work on our about Rebasing also allowed us to integrate the most up-to-date version of Master branch, enabling us to do a fast-forward merge later on. Rebasing the about branch ontoĪfter the rebase, about is a linear extension of the Requires you to be on the branch that you want to move. Notice that, like the git merge command, git rebase Master branch, which is visualized in the following diagram. The rebase took the entireĪbout branch and plopped it onto the tip of the Originally, the about branch was based on the Mergeīranch 'crazy-experiment' commit. git checkout about git rebase master git log -oneline Only this time we’ll do it with a rebase instead of a merge. We want to pull changes from master into a feature branch, This puts us in the exact same position as we were in before our first 3-way News-hotfix, so Git can perform a fast-forward merge. The master branch hasn’t been altered since we created git checkout master git merge news-hotfix git branch -d news-hotfix We’re ready to merge the news update back into Stage and commit another snapshot: git add news-2.html git status git commit -m "Add article for 2nd news item" Publish News Hotfix Then, create a new page called news-2.html: A Red Rebellion A Red Rebellion Earlier today, several American design firmsĪnnounced that they have completely rejected the use Make sure to base the updates on master, not theĪbout branch: git checkout master git branch news-hotfix git checkout news-hotfix git branchĬhange the “News” section in index.html to: News Blue Is The New Hue Our New Rainbow A Red Rebellion Ĭommit a snapshot: git status git commit -a -m "Add 2nd news item to index page" Use a hotfix branch to update the site without affecting our about pageĭevelopments. Our boss just gave us some more breaking news! Again, we’ll Adding the about branch Another Emergency Update! git status git commit -a -m "Add contents to about page"Īfter a few commits on this branch, our history looks like theįollowing. Next, we’ll add some HTML to about/index.html: About Us About Us We're a small, colorful website with just two employees: Me: The Developer Mary: The Graphic Designer Return to home page Note that git add can also add entire directories to the git add about git status git commit -m "Add empty page in about section" Then, create the emptyįile about/index.html. The next few steps break this feature into several unnecessarily smallĬommits so that we can see the effects of a rebase. Should be doing all of our work in isolated branches so that we don’tĬause any unintended changes to the stable version of the project. We’ll begin by creating an about page for the website. The above link, uncompress it, and you’re good to go. Otherwise, download the zipped Git repository from If you’ve been following along from the previous module, you already Go back and rewrite history using git rebase. Our example project so that we have something to work with. To explore Git’s rebasing capabilities, we’ll need to build up Perfectly linear history that reads more like a story than the hodgepodge of The branches with a merge commit, rebasing integrates the featureīranch by building on top of master. Which is the same commit pointed to by master. Conceptually, this is what it allows us toĭo: Rebasing a feature branch onto masterĪfter rebasing, the feature branch has a new parent commit, Rebasing lets us move branches around by changing the commit *33e25c9 Rename crazy.html to rainbow.htmlĥ06bb9b Revert "Add a crazzzy experiment"įortunately, Git includes a tool to help us clean up our commits: git *6aa4b3b Add CSS stylesheet to rainbow.html In other words, our repository’s history is kind With commits from other branches, along with a superfluous merge commit We evenĭeveloped them in their own feature branch. The six commits asterisked below are part of the same train of thought. Let’s start this module by taking an in-depth look at our history.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |