75

Is there a way to run git commit and git push in the Atom editor?

I read this blog post but could not find that mentioned: http://blog.atom.io/2014/03/13/git-integration.html

5 Answers 5

82

What you're looking for is the git-plus package. Install that - it provides full Git integration with commands like commit, add, push, pull and lots of others.

Git-Plus

6
  • 4
    After installing this how do I use this ? Dec 24, 2015 at 16:27
  • 9
    @AkshayLAradhya Press 'Ctrl+Shift+H' and you'll get a palette with all the commands provided by git-plus. ('Cmd+Shift+H' if you're using OSX)
    – oxalorg
    Jan 10, 2016 at 6:47
  • 1
    @AkshayLAradhya The commands are also available from the Packages->Git-plus menu
    – Chris B
    Apr 26, 2016 at 14:49
  • how do you open that terminal looking thing where you type in "git wr" and "git com" @nwinkler
    – Drmjo
    Jun 24, 2016 at 18:38
  • 2
    @Drmjo you've found this out by now for sure but it's ctrl (or cmd on mac) + shift + P
    – SidOfc
    Jul 21, 2016 at 10:21
62

There've been some developments since this question was initially asked. Both git commit and git push (along with lotsa other commands) are now available in the app natively (version 1.18+).

There is a GUI for staging and reviewing changes as well as committing them with a commit message.

enter image description here

Just double-click to stage or un-stage files. Clicking on a file in Atom's Git GUI will load up the colored diff for reviewing changes. Type in a commit message right there in the text entry box and click the button to make the commit! Commit title's with message bodies (just a new line separating them) is supported - there's even a counter to let you know when your git commit message title is getting too long.

Also, when you have a change that's been staged and committed, you can push the contribution to your GitHub repository by pushing the down/up arrows at the bottom right to load up the options:

enter image description here

...then selecting the "Push" option:

enter image description here

Up goes your commits to the cloud!

See: https://github.atom.io/

Note as well that there is a branch display which can be used to switch branches or create new ones. Also, you can do pulls and fetching.


To stage new files and changes, and make a commit you also can access the git tools from either the Packages Tab:

enter image description here

... or the View Tab:

enter image description here

A push will, of course, require your username and password.

Also, setting up the GitHub preview requires authentication:

enter image description here


ctrl+9 opens the "Git" pane
...and ctrl+shift+9 will close it.

ctrl+8 opens the "GitHub(preview)" pane
...and ctrl+shift+8 will close it.

One way to configure git so you can bypass manually entering your username and password while using these Atom features:

  1. Set your Git user info in the .gitconfig file.

  2. On Windows this is usually located in your Users folder.

    Example: If your username was Bob, your .gitconfig should be in: C:\Users\Bob.gitconfig

  3. If this file doesn't exist, you need to create it and fill it out as followed:

  4. (fill in the name and email part and save)

    [user]
        name = {NAME}
        email = {EMAIL}

See also: https://help.github.com/articles/caching-your-github-password-in-git/

2
  • 4
    Brilliant! Should be the accepted answer because it doesn't require additional packages to be installed. Thanks Mar 1, 2018 at 23:06
  • I have 2 remotes set up. I want to specify which remote to push to. Can I do that in Atom? I don't see how to do it directly from the GUI. Or do I need an additional package?
    – sripwoud
    Sep 15, 2018 at 9:06
5

You can also use a git GUI package: git-control. It is easier to use and there is a small display of auto generated git commands, which is very helpful for beginners to get a good idea about git and version control.

git control package from Atom.io

0

There's also one more nice sweet package for commits: git-commit.

Good news: it's super quick to commit all your stuff.

Bad news: it doesn't support pushing.


(source: github-camo.com)

1
  • push can be added on post-commit, nice when working alone
    – olamedia
    Nov 7, 2016 at 12:20
0

In order to make the process more automatic, I have switched to another strategy to avoid having to click on too many buttons (am I lazy or it is worth the time?).

The idea is to create a small Makefile file at the root of your project which would contain something like:

default: git

git:
    git commit -am'Atom edits'
    git push

I am then using the excellent build-make package to run that two commands in one key stroke <Cmd>-<Alt>-B in my case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.