Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a function/plugin for line-by-line staging in atom.io?

On thing I really like about eclipse (and the 0.x version of gitg) is the possibility to stage changes line-by-line (see line 10 in the image below).

enter image description here

Is there plugin that allows this in the editor atom.io? (place old and new version next to each other, and allow to stage/revert the change)?

I installed the plugin git-plus, but this stages all changes for a given file,...

like image 883
Edward Avatar asked Oct 05 '15 09:10

Edward


People also ask

Does atom have version control?

Version control is an important aspect of any project and Atom comes with basic Git and GitHub integration built in. In order to use version control in Atom, the project root needs to contain the Git repository.

How do I open a Git repository in atom?

Press ctrl + alt + o or type Git Projects: Toggle in the Command Palette to open project in a new window. Press ctrl + alt + shift + o or type Git Projects: Toggle Add in the Command Palette to add project to current window.


1 Answers

It is possible to do directly from Atom, with the git-plus package installed, once you have made two or more changes to a file far enough apart to be considered by git to be separate hunks then you can us the Git Plus: Stage Hunk command:

  1. Press Ctrl-Shift-P to open the Command Palette.
  2. Start typing Stage Hunk until Git Plus: Stage Hunk is selected.
  3. Select the file you want to stage a hunk from.
  4. Select the hunk you want to stage, this will place a green tick next to it, select any additional hunks you want to stage in the same way.
  5. Press Shift-Enter to stage the hunk(s).

I have created a little animation to demonstrate this:

Git Plus: Stage Hunk

like image 177
Richard Slater Avatar answered Sep 16 '22 11:09

Richard Slater