Tips & Tricks

GitHub right in your IDE

Collaborative coding and versioning are essential for software projects. Like many others JetBrains IDEs AppCode supports a variety of Version Control Systems including Mercurial, CVS, Git, Subversion and TFS. Actions that users are provided with in various VCS tools are integrated directly into the IDE environment and look unified regardless of exact versioning system used. A helpful webinar to start with VCS in any IntelliJ-based IDE can be found on our YouTube channel or you can read an earlier overview post.
Here we would like to share some recipes and hints for one particular system – GitHub that is one of the most popular choices in the community among all platforms for hosting Git repositories. Especially often it becomes a dock for open source ships. Like CocoaPods for example.
Available in products

Start a project
To work with GitHub first specify your credentials in Preferences | Version Control | GitHub. Now you can create a new repository for your code easily:
AppCode knows if you are able to create private repositories depending on the type of your account:
You can start your development in another way, by checking out an existing project from GitHub. Browse through all your GitHub repositories from the IDE menu and pick one to clone:
After that you will be able to perform all the standard actions like commit, browse changes and history, prepare patches or postpone commits to the shelves, create change lists, annotate the code base to investigate who and when made a change in a particular code line and so on.

Once you’ve forked someone’s repository you may want to stay up to date with the origin project. For this rebase your own fork into the origin in several clicks from the AppCode IDE: select VCS | Git | Rebase my GitHub fork. You can see the status update in the Event Log, or in the status balloon that pops up:

Pull requests
Creating pull requests is a nice way to share your code with the community and to follow the collaborative development. With it you can tell others about the changes you’ve made and ask for the comments, review or just share the knowledge. With all this going on pull request will appear in the original repository only after approvement.
To prepare a pull request you don’t need to switch to the browser – you can do it right from the IDE itself, just select VCS | Git | Create Pull Request, point target branch, give some title to your request and add a description for more convenient usage:
You can Show Diff for all the changes that will be included in the request or browse the Log in the adjacent tab to learn more about commit list:

Issues tracker
When working on a project you may want to collaborate with others on the issues (be it bugs or features) and also track them for yourself in some convenient way. GitHub suggests nice and elegant solution integrated into its interface. We also support the idea and have GitHub issue tracker integrated into AppCode!
To start with any kind of the issue tracker (not only GitHub one) you should configure the preferable task server in Tools | Tasks & Contexts | Configure Servers first. There you can select from a bunch of issue trackers available:
And then fill the the server credentials including repository and commit message format. After that you can start working with the GitHub issues. You can create local tasks or select from the existing set (including both: local and remote) go to Tools |  Tasks & Contexts | Open Task (or just press Alt+Shift+N). You can include closed task to the selection and see issue description and comments with F1 key:
Start typing and you’ll see the matching issues or a suggestion to create a new task. You can create a branch for your task and also a changelist to separate the work done over this particular issue from the other part. If “Clear current context” option is selected AppCode will close all files currently opened and create a new context for the work you are going to do right after you click OK button:
You can close active tasks from Tools |  Tasks & Contexts | Close Active Task or by Alt+Shift+W. And when you decide to commit changes (Cmd+K) commit message will be automatically generated based on the issue you are working on.

Git gists and snippets sharing from the IDE
From time to time you may want to reuse some small pretty pieces of code or text or description or whatever else and create so called snippet and share it with others. GitHub supports this idea excellently and provides you with where these code snippets can be shared, versioned, forked and used through the Git and AppCode allows you to create such gists from the IDE without switching to the browser! Just select a piece of code and call Create Gist from the context menu. You can choose whether you want to make your snippet private, or anonymous:
And even look at it in the Browser after creation:
By the way you can also open any file from your project in Browser with just selecting Open on GitHub in context menu.

And what’s your favorite GitHub action that you’d like to be integrated into the IDE to avoid unnecessary context-switching?

Comments below can no longer be edited.

16 Responses to GitHub right in your IDE

  1. Avatar

    Paul says:

    March 10, 2014

    Does anyone know how to mark a header as public? The header files of new classes are always marked “Project”, and I have to go into Xcode’s Target Membership pane to change it. Is there anyway to do this in AppCode? Thanks.

    • Avatar

      Alexey Ushakov says:

      March 11, 2014

      Hi Paul,

      Unfortunately, there is no way to mark a header public in AppCode at the moment.
      We’re working on better project settings support.

      • Avatar

        Paul says:

        March 11, 2014

        Thanks. Is this on the roadmap already or is it worth opening a feature request for this?

  2. Avatar

    Divyakumar Jain says:

    December 16, 2014

    It will be nice to have a feature to create a local branch from github Pull request will speed up local testing and review of Pull request. This is because i can quickly see the difference using Cntl+D of changes fetched locally and navigate across the code quickly using cntl+click to other areas in code which which are called in new code in Pull request.

  3. Avatar

    Shannon Thrasher says:

    January 29, 2015

    Im not sure where to post problems with the GitHub Integration plugin…

    The symptom: “Open in GitHub” context menu is going to GitHub homepage.

    My repo Host setting looks something like this:

    For some reason the tree was moved in github to here (note missing “scm”)

    So when the tree opens, GitHub returns a 404 and redirects me to the homepage.

    Im not sure if GitHub was restructured or if my company’s account changed but I need to be able to specify the “Open in GitHub” url.

  4. Avatar

    foobra says:

    May 15, 2015

    Can I use per-line comment for pull-request?
    Because I use AppCode to do the diff for pull-requesrt, and I want to commit per-line to review other’s code, can I do this in AppCode or plugin? thx

  5. Avatar

    foobra says:

    May 15, 2015

    Can I use per-line comment for pull-request?
    Because I use AppCode to do the diff for pull-requesrt, and I want to commit per-line to review other’s code, can I do this in AppCode or plugin? thx.

  6. Avatar

    Dmitry Zaytsev says:

    July 6, 2015

    Would be nice to have possibility to view and comment on GitHub pull requests.

    Since GitHub is not fully showing diff for large pull requests (300+ files… yeah, sometimes we have those), I’m forced to do review in IDE. However, commenting still remains an issue.

  7. Avatar

    Gil Zellner says:

    May 15, 2016

    It would be nice if I could see the comments from a pull request on the code in the ide.

  8. Avatar

    Kayvan says:

    August 15, 2017

    Is there a way to look at the description of the active task after opening it?

  9. Avatar

    Tomasz Przybysz says:

    September 5, 2017

    Commenting a PR, submitting a review and addressing comments without leaving IDE would be a major thing.

Discover more