Skip to content

how to set "staging of untracked files" ? #4408

Closed

Description

@qq575654643

how to set "staging of untracked files" like git gui ?
i think it can right click,so it will to have rich function.

Activity

  1. shiftkey commented on Apr 8, 2018

    @shiftkey
    Member

    @qq575654643 GitHub Desktop doesn't support staging of files from in the application, and I'll explain how it's currently working to help illustrate why we've designed the app this way.

    When you have untracked files in a repository, they will appear in the Changes list as files with the green + icon, to indicate these are new files:

    To include these files in a commit, you use the checkbox next to each file. Using the example of the above screenshot, all three files will be committed.

    To ensure Desktop crafts the commit you've chosen, it will go through these steps after you've filled out a commit summary (and optional description):

    • reset the index of the Git repository, so that changes by external tools are not accidentally included in your commit
    • for each file selected, either stage the whole file, or stage selected lines if the user has chosen to make a partial commit
    • finally, make the commit using the summary and description entered

    We avoid explicit staging support in the app because we don't want users to have to learn about the index and be conscious of the state of the index when making commits.

    Let me know if you have any other questions about this.

  2. added
    more-info-needed
    on Apr 8, 2018
  3. shiftkey commented on Apr 16, 2018

    @shiftkey
    Member

    Closing this out as inactive. @qq575654643 let me know if there's any other questions you have about how Desktop works around staging files for committing.

  4. locked as resolved and limited conversation to collaborators on Jul 17, 2018
  5. unlocked this conversation on Sep 27, 2018
  6. nilsandrey commented on Nov 19, 2020

    @nilsandrey

    A manual moved file appears to git status as two files, one deleted and the other added. On the other hand, if you stage both changes, git status it's shown as a rename.

    image

    There're a couple more use cases for having control via IDE of the index or stage files, I think it's very useful for advanced users, and a few IDEs like VS Code solve both uses beautifully. (e.g., When you want to ensure some changes and keep testing or fooling around with others, then revert those without fear about the staged ones)

    I'll love Github desktop supporting this, maybe the same way VS Code does (perhaps without the warning when directly committing changes without staging anything). Or maybe with some checkmark on Advanced options.

  7. sdegutis commented on Mar 16, 2021

    @sdegutis
    • reset the index of the Git repository, so that changes by external tools are not accidentally included in your commit

    Seems like this could be done by just syncing the app's state with the git index whenever the app is refocused, or at intervals just to be sure.

    We avoid explicit staging support in the app because we don't want users to have to learn about the index and be conscious of the state of the index when making commits.

    Oh, I see. This is actually the real motivation behind these design decisions (see also #1644 (comment)): it's apparently that Github Desktop is a git client mostly for very non-technical users.

    I conclude that because the git index is an extremely basic and fundamental part of git. In fact, the visualization of staged/non-staged files/lines in Github Desktop is already a complete tutorial of the git index and how it works. When a person knows how to use Github Desktop to commit files/lines, they already understand the git index pretty much fully, at least insofar as it relates to the kind of usage of git that Github Desktop already enables.

    In the issue I linked to, @billygriffin stated that this design decision is not open for debate, and that's fair, since it's your creation so you get to choose what it is and becomes. But I'm convinced it's the wrong design decision, based purely on what I have read here, which he has pointed me to. So I wanted to let you know my reasoning (above), so that it can at least be reconsidered.

    Because, as I said in that issue, it was very surprising and disappointing to me to find out, when I tried Github Desktop the other day, that it stages everything in memory and has nothing to do with the real git index. But I think a more relevant downside is that it prevents features like #1644 from being implemented without reinventing git features inside the app.

  8. zmerson commented on Aug 10, 2022

    @zmerson

    First off I'll admit that I suck at git and probably did something wrong (hence why I'm trying to use the desktop app), but from what I'm seeing, your post is straight up misinformation.

    The green plus sign is clicked. I put a title and description for the commit. I click 'commit to main' => error that my files are untracked. And no, it's not already uploaded on my origin/main. I had just added this file 30 mins ago and I double checked my account which hasn't had any upload in 4 days.

    So, what did I do? Are my files 'untracked'? How do i 'track' files in the desktop client? Can I 'drag and drop' a file in the year 2022 without pulling out my hair ? ?

    a google search lead me to believe that I cannot 'add tracked files' in this desktop client, as the people suggest that I use a command in the command line.

    image
    image

    @qq575654643 GitHub Desktop doesn't support staging of files from in the application, and I'll explain how it's currently working to help illustrate why we've designed the app this way.

    When you have untracked files in a repository, they will appear in the Changes list as files with the green + icon, to indicate these are new files:

    To include these files in a commit, you use the checkbox next to each file. Using the example of the above screenshot, all three files will be committed.

    To ensure Desktop crafts the commit you've chosen, it will go through these steps after you've filled out a commit summary (and optional description):

    • reset the index of the Git repository, so that changes by external tools are not accidentally included in your commit
    • for each file selected, either stage the whole file, or stage selected lines if the user has chosen to make a partial commit
    • finally, make the commit using the summary and description entered

    We avoid explicit staging support in the app because we don't want users to have to learn about the index and be conscious of the state of the index when making commits.

    Let me know if you have any other questions about this.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    more-info-needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions