Unlimited Plugins, WordPress themes, videos & courses! Unlimited asset downloads! From $16.50/m
by
Lessons:28Length:1.7 hours
Speedy workflows with atom.io
  • Overview
  • Transcript

6.9 Advanced Git Integration With git-plus

Surprisingly advance get actions are one of the missing features of Atom. Atom allows you to open up files in GitHub natively but there's actually no support for your basic GitHub workflow. If we wanna add, commit, or push source code, we still heavily rely on using the command line. This requires us to switch back and forth between the editor and the console, which is disjointing and really does disrupt our workflow. The goal is is we'd want to stay in our editor as much as possible. And this will allow us to be a lot more productive rather than switching back and forth. Since this functionality isn't available natively, we're going to use a package called GetPlus. In Atom we have a project opened up called get better. From here we'll install get plus. We'll install it through the settings. Hit Cmd + comma to open up the settings, and go to the packages tab. Type in git-plus. From the search we can click install and while it's installing, we'll click, learn more. Git-plus allows us to do advanced git actions in Atom. We can add, commit, check out, and even add new branches. We're also providing key bindings, as well. To add files, we can hit, Cmd + Shift + A. And to do a commit, Cmd + Shift + C. Now that it's done installing, we'll close out of the settings. Git Plus has it own Command Palette. To activate it we hit, Cmd+Shift+H. The only option in the beginning is to initialize. We get a message letting us know it's been initialized and we have the hidden .git file in the preview. Let's go create a new file by hitting Cmd + N. We'll create a readme.md, and we'll type in our readme message. We'll Cmd + Shift + A to add the changes, then command Shift + C to commit. When committing a pane will split out to the right. At the bottom, all the changes are listed. In this case it's just a new file which is the read me. At the top, we can provide a message. When we save, it will fire off the commit. The next step is to push. We'll open up the git plus command pallet, Cmd+Shift+H. From here we'll type push. We'll hit enter. And git plus let's us know that no matches were found. This is because we don't have a GitHub repo created. We'll have to go out to GitHub, create a repo, and use the command line to set the origin. This will be the only time that we'll be interacting with the command line. Out in GitHub we'll create a repository called Get Better. We'll click create. We'll copy this URL. We'll open up a command line instance. From here, we'll set the remote origin. No message appears, but that's fine. We'll close out of the terminal. Now we'll try our push again. Cmd + Shift + H, type in push and hit enter. Once the push is successful, we'll see the message at the bottom. And we can check this out in GitHub. To pull this up in GitHub we can use the key bindings provided by Atom. And that's option G, then O. When GitHub pulls up, we see the readme file that we added. Down at the bottom right, Atom lets us know what branch we're currently in. Let's go and create a new branch. Open up the command palette and type in branch. Hit enter for check out new branch. And we'll this new branch big-update. We'll type in the message for our new big-update. After saving, we'll hit Cmd + Shift + A to add the file. To commit this we'll hit Cmd + Shift + C. The status is that we've modified the readme. We'll save to commit, from the command power we will push. After the successful push we'll open up and Github. Option G then O. And our big 2.O update has been applied. Will go to the main page for the repo. And Getup lets us know that we can create a pole request from the new branch. We'll click compare and pole request, to the right, we'll click pole request. Since we know this works, we'll merge it and confirm the merge. Now back in the main page, our update has been applied to the master branch. In Atom we're still on the big update branch. So lets switch over to the master. We'll type in checkout and hit enter. From here we see the two branches, we have big update which is our current branch, and then master. We'll select master and in addition to getting a message we see that the bottom right lets us know we're in master. One thing to notice is that our change is in the master branch. To get our changes we need to do a pull. From the command pallet we type in pull. And we wanna pull from master. Once the poll has been downloaded we can see our update. Now let's go and make an update, but we're not sure if we're going to commit it so we'll make sure to stash it. To stash we'll open up the command pallet and type in stash. We'll go down to save changes. Once we hit Enter, we get a message letting us know that our stash has been saved and our update has been removed. If we wanted to see our update again, from the Command palette, we can type in stash, and we can pop or apply the stash. Once the stash is popped, our change is back. If we hit Save, we can go and stash our change again. You save the stash, so the change gets removed. And now we can delete the stash. Go down to delete, or drop the stash. And our stash is gone. So if we try to pop the stash again, the message lets us know that no stash has been found. Now we wanna go and create a new file. We'll hit Cmd + N, and we'll save this as test.md. We'll type in our test message. We'll add this file with Cmd + Shift + A. And we'll commit with Cmd + Shift + C. The commit lets us know that this new files been added. So we'll save to commit. Now we'll push our changes to GitHub. And using option G and O will pull it up. We'll go to the main page. From there we see the read me and the test. At this point we realize this was a bit of a mistake, we want to get rid of this read me. In Atom, we could delete this readme and push again. However, this won't actually remove it from the GitHub repo. To do that, we have to do a remove. From the command pallet, we type in remove, and we want to remove the current file. Now if we do a commit, the commit lets us know that we've deleted the test readme file. Now when we save, we can go and push. Back in GitHub, our test.md has been removed. By using Git Plus, we remove the need to switch back and forth from the command line and the editor. This will allow us to stay in the editor and be focused. So the next time you find yourself switching back and forth, try using Git Plus instead.

Back to the top