Asimov4
Asimov4

Reputation: 2854

How can I run `git commit` and `git push` in atom?

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

Upvotes: 75

Views: 92000

Answers (5)

meduz
meduz

Reputation: 4241

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.

Upvotes: 0

mik01aj
mik01aj

Reputation: 12382

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)

Upvotes: 0

MmmHmm
MmmHmm

Reputation: 3785

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/

Upvotes: 62

gourxb
gourxb

Reputation: 325

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

Upvotes: 5

nwinkler
nwinkler

Reputation: 54457

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

Upvotes: 82

Related Questions