Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Craft a commit (hunks, commit only staged changes) ?
Craft a commit (hunks, commit only staged changes) ? [message #526469] Sun, 11 April 2010 15:10 Go to next message
Michael Pellaton is currently offline Michael PellatonFriend
Messages: 289
Registered: July 2009
Senior Member
Hello

I figured out how to stage all changes of a file in the commit dialog
(and then pressing cancel), and if the file gets changes afterwards,
it gets decorated accordingly. However, how can I now commit just the
staged changes - not all changes?

What EGit IMHO does right now is:
# commit all changes of the file
$ git commit -a

I am looking for the EGit equivalents of the following git commands:
# commit only staged changes
$ git commit

# unstage a file
$ git reset HEAD

# only stage some hunks of the changes of the file
$ git add -i

The following additional questions are all related to staging/
committing:
- How can I edit the hunks of a change?
- How can I diff the staged changes vs repo ($ git diff --cached)?
- How can I diff an entire project, not just a single file (context menu
always disbaled when diff is done on a project/package) ($ git diff)?

Thanks

Michael
Re: Craft a commit (hunks, commit only staged changes) ? [message #526865 is a reply to message #526469] Tue, 13 April 2010 10:46 Go to previous messageGo to next message
Stefan Lay is currently offline Stefan LayFriend
Messages: 342
Registered: July 2009
Senior Member
Hi Michael,

everything you mention are features that should be added to EGit but are not
there yet. In particular the Git index support was not very much in focus so
far.

We track and discuss future changes and enhancement requests in the eclipse
bugzilla. You are very welcome to file bugs there for missing features.

"Michael Pellaton" <groups@pellaton.li> wrote in message
news:hpsool$of4$1@build.eclipse.org...
> Hello
>

> What EGit IMHO does right now is:
> # commit all changes of the file
> $ git commit -a

You're right, this is what EGit currently does.


> I am looking for the EGit equivalents of the following git commands:
> # commit only staged changes
> $ git commit

I think there should be a commit dialog similar to git gui with two
different lists: the working tree changes and the staged changes.
Per default only the staged changes should be commited.

> # unstage a file
> $ git reset HEAD

Yes, that's really needed, but first it should be possible to commit the
staged changes. Otherwise there is no usecase in EGit to unstage files.

> # only stage some hunks of the changes of the file
> $ git add -i
Yes, of course, but more advanced.

> The following additional questions are all related to staging/
> committing:
> - How can I edit the hunks of a change?
Not yet.
> - How can I diff the staged changes vs repo ($ git diff --cached)?
This will be needed when it is possible to commit only the staged changes.

> - How can I diff an entire project, not just a single file (context menu
> always disbaled when diff is done on a project/package) ($ git diff)?
This is also not implemented yet.

Thanks for your help!
Stefan
Re: Craft a commit (hunks, commit only staged changes) ? [message #527613 is a reply to message #526865] Thu, 15 April 2010 18:19 Go to previous message
Michael Pellaton is currently offline Michael PellatonFriend
Messages: 289
Registered: July 2009
Senior Member
Hello Stefan

> You are very welcome to file bugs there for missing features.
Following your advice, I filed a bunch of enhancement requests.

>> I am looking for the EGit equivalents of the following git commands:
>> # commit only staged changes
>> $ git commit
>
> I think there should be a commit dialog similar to git gui with two
> different lists: the working tree changes and the staged changes.
> Per default only the staged changes should be commited.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=309359

>> # unstage a file
>> $ git reset HEAD
> Yes, that's really needed, but first it should be possible to commit the
> staged changes. Otherwise there is no usecase in EGit to unstage files.
>
>> # only stage some hunks of the changes of the file
>> $ git add -i
> Yes, of course, but more advanced.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=309362

>> The following additional questions are all related to staging/
>> committing:
>> - How can I edit the hunks of a change?
> Not yet.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=309365

>> - How can I diff the staged changes vs repo ($ git diff --cached)?
> This will be needed when it is possible to commit only the staged changes.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=309366


Thanks

Michael
Re: Craft a commit (hunks, commit only staged changes) ? [message #579363 is a reply to message #526469] Tue, 13 April 2010 10:46 Go to previous message
Stefan Lay is currently offline Stefan LayFriend
Messages: 342
Registered: July 2009
Senior Member
Hi Michael,

everything you mention are features that should be added to EGit but are not
there yet. In particular the Git index support was not very much in focus so
far.

We track and discuss future changes and enhancement requests in the eclipse
bugzilla. You are very welcome to file bugs there for missing features.

"Michael Pellaton" <groups@pellaton.li> wrote in message
news:hpsool$of4$1@build.eclipse.org...
> Hello
>

> What EGit IMHO does right now is:
> # commit all changes of the file
> $ git commit -a

You're right, this is what EGit currently does.


> I am looking for the EGit equivalents of the following git commands:
> # commit only staged changes
> $ git commit

I think there should be a commit dialog similar to git gui with two
different lists: the working tree changes and the staged changes.
Per default only the staged changes should be commited.

> # unstage a file
> $ git reset HEAD

Yes, that's really needed, but first it should be possible to commit the
staged changes. Otherwise there is no usecase in EGit to unstage files.

> # only stage some hunks of the changes of the file
> $ git add -i
Yes, of course, but more advanced.

> The following additional questions are all related to staging/
> committing:
> - How can I edit the hunks of a change?
Not yet.
> - How can I diff the staged changes vs repo ($ git diff --cached)?
This will be needed when it is possible to commit only the staged changes.

> - How can I diff an entire project, not just a single file (context menu
> always disbaled when diff is done on a project/package) ($ git diff)?
This is also not implemented yet.

Thanks for your help!
Stefan
Re: Craft a commit (hunks, commit only staged changes) ? [message #579612 is a reply to message #526865] Thu, 15 April 2010 18:19 Go to previous message
Michael Pellaton is currently offline Michael PellatonFriend
Messages: 289
Registered: July 2009
Senior Member
Hello Stefan

> You are very welcome to file bugs there for missing features.
Following your advice, I filed a bunch of enhancement requests.

>> I am looking for the EGit equivalents of the following git commands:
>> # commit only staged changes
>> $ git commit
>
> I think there should be a commit dialog similar to git gui with two
> different lists: the working tree changes and the staged changes.
> Per default only the staged changes should be commited.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=309359

>> # unstage a file
>> $ git reset HEAD
> Yes, that's really needed, but first it should be possible to commit the
> staged changes. Otherwise there is no usecase in EGit to unstage files.
>
>> # only stage some hunks of the changes of the file
>> $ git add -i
> Yes, of course, but more advanced.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=309362

>> The following additional questions are all related to staging/
>> committing:
>> - How can I edit the hunks of a change?
> Not yet.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=309365

>> - How can I diff the staged changes vs repo ($ git diff --cached)?
> This will be needed when it is possible to commit only the staged changes.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=309366


Thanks

Michael
Previous Topic:Stashing in EGit
Next Topic:ERROR in org.eclipse.ui.examples.presentation.git
Goto Forum:
  


Current Time: Fri Apr 26 07:41:20 GMT 2024

Powered by FUDForum. Page generated in 0.04627 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top