3 Quick Git “Show-Me” Videos From Our IDE Family

Git is a fantastic and wildly popular version control system. Once you get beyond the basics, though, it can be a bit cryptic for civilians. Fortunately, this is an area where JetBrains IDEs can help, by putting a visual face on the underlying git commands.

Our colleagues in PhpStorm and IntelliJ recently tried a fun new approach at showing this. Since Git/GitHub support is largely shared across all of our IDEs, why not do a series of task-oriented, bite-sized screencasts featuring two IDEs tackling a certain Git workflow? And since version control, like so many of our features, is shared across IDEs…why not share their first 3 videos with our PyCharm folks?

How do I switch branches without losing my work?

You’re in the middle of heavy development. Your work is on a branch, which is the way the gods intended. However, you need to do something else — fix a bug on the master branch, review someone else’s work on a branch, etc. But you can’t switch off of your branch when you have uncommitted work.

Rather than do a “maybe this works” commit, you have several choices. This bite-sized video shows Trisha and Gary in a real-world scenario, letting their JetBrains IDEs (IntelliJ and PhpStorm) put a friendly face on the operations. And remember, PyCharm is the same for version control as the other JetBrains IDEs. Items covered:

  • On a branch, in the middle of huge unfinished work porting to Php 7, but need to investigate a bug on that branch
  • Use the IDE’s shelve feature to move changes out-of-the-way, instead of committing
  • This restores the branch to its head state with no changes
  • Later, “unshelve” to re-apply the changes, possibly to a new branch

I often find myself in this pattern. For example, I’m working on some feature. I get a bee in my bonnet and do some unrelated work, get myself into a bind, and need to…do something. With this, instead of committing, I can get the work off the branch and into a place where it belongs.

How to Keep a Git Fork up to Date?

Forking on GitHub is a wonderful facility, allowing people to modify code and even submit improvements back, without being added as a contributor to the main code base. But once you’ve forked, how do you stay up-to-date with the original?

Gary and Trisha cover this, again using PhpStorm and IntelliJ to show:

  • A local checkout with two remotes — the “upstream” original and the “origin” containing the personal fork
  • Use fetch to non-destructively get a listing of the upstream’s changes, then a pull to get those changes from upstream into the local checkout
  • Push those upstream changes into your fork i.e. the “origin” remote

How Do I Start Working with Open Source and GitHub?

Of course these two videos presume you already have a project checked out and ready to go. But how do you get started with open source? How do you get a project on GitHub into a fork and into your IDE?

For both IntelliJ and WebStorm, Trisha and Gary show this in action:

  • Find an interesting project and fork it into your personal GitHub organization
  • Copy the URL for that fork and use it to start a new project in your IDE
  • Track the original by adding the repository URL for the “upstream” remote

Conclusion

These three videos tackle specific workflows related to Git. If you find this approach interesting and have a suggestion for another video, put in a comment on the YouTube page for one of the videos. In fact, the third video was selected based on an earlier comment.

This entry was posted in Cool Feature, Screencast, Video and tagged . Bookmark the permalink.

One Response to 3 Quick Git “Show-Me” Videos From Our IDE Family

  1. Adelle says:

    Great tutorials! Useful stuff! Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *