Skip to content

Only git add files before committing #848

Closed

Description

@gyk

Currently whenever a file is modified, it will be added to staging area immediately (so the working tree and the staging area are always the same), which is unnecessary.

Proposed changes:

  1. git add when a file is created.
  2. git rm when a file is removed.
  3. git mv when a file is renamed.
  4. git add --update before committing the change.

Or, just

  1. git add --all before committing the change.

Drawbacks:

  1. isomorphic-git might have performance issue when adding a lot of files.

Activity

  1. self-assigned this
    on Dec 8, 2020
  2. tiensonqin commented on Dec 22, 2020

    @tiensonqin
    Contributor

    @gyk Is it solved now?

  3. gyk commented on Dec 23, 2020

    @gyk
    ContributorAuthor

    @tiensonqin With PR #966, this can be done by simply removing all Git add/rm/mv operations except for those in repo/push. It should work fine, but if there are some unexpected edge cases, the users might lose data again.

  4. tiensonqin commented on Dec 23, 2020

    @tiensonqin
    Contributor

    @gyk let's make the changes and give it some tests before the release. It'll make the following refactoring a lot easier by removing those git ops. But it's not a high priority thing.

  5. gyk commented on Dec 23, 2020

    @gyk
    ContributorAuthor
  6. tiensonqin commented on Jan 14, 2021

    @tiensonqin
    Contributor

    Will close this issue and address the code changes soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions