Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File renaming/moving support #13588

Open
SHA65536 opened this issue Dec 23, 2021 · 9 comments
Open

File renaming/moving support #13588

SHA65536 opened this issue Dec 23, 2021 · 9 comments

Comments

@SHA65536
Copy link

Describe the feature or problem you’d like to solve

Support for moving/renaming files.
I think it would be a useful idea to add a capability to rename/move files or at least detect when a file was renamed.
Currently if I rename a file it will detect as if that file has been deleted, and a new file has been added
This produces extra diffs and clogs up the history.

Proposed solution

This could be solved by either detecting file renames by looking at remove and add differences with the same contents
Or by implementing a rename/move dialog from inside Github Desktop.
Then it's just executing 'git mv src dst'.

Additional context

Thanks! :D

@RefinedSoftwareLLC
Copy link

RefinedSoftwareLLC commented Feb 9, 2022

This is still an issue with v2.9.6 on Linux.

  1. Using GitHub Desktop make commit a png to your repository (1st commit).
  2. Now rename the png.
  3. Notice in GitHub Desktop's Changes Tab: Your pending change is a delete + an add (This should be a rename).
  4. Commit changes (2nd commit).
  5. Notice in GitHub Desktop's History Tab: Your 2nd commit shows as a rename.

I know extra processing happens when you commit (with internal hashing and packing) but if it will show up as a rename in the History Tab, then it should show up as a rename in the Changes Tab.

@Calinou
Copy link

Calinou commented Feb 10, 2022

@RefinedSoftwareLLC Can you reproduce this using the Git command line? If so, this is not an issue with GitHub Desktop.

@sfadschm
Copy link

sfadschm commented Mar 4, 2022

I can confirm on Windows that the same issue occurs, but is rather a git issue:

  1. Rename a tracked file (Desktop shows add/delete):

    \>git status
    On branch develop
    
     Changes not staged for commit:
       (use "git add/rm <file>..." to update what will be committed)
       (use "git restore <file>..." to discard changes in working directory)
             deleted:    NameA.pdf
    
      Untracked files:
        (use "git add <file>..." to include in what will be committed)
              NameB.pdf
    
  2. Commit via Desktop but abort signing process (Desktop shows rename):

    >git status
    On branch develop
    Changes to be committed:
      (use "git restore --staged <file>..." to unstage)
            renamed:    NameA.pdf -> NameB.pdf
    

So I guess detection only runs during staging of the changed files.
While this is not primarily a Desktop problem, how about something like a "prepare Commit" button, which does the tracking and hence displays the "real" commit changes?

@avalonv
Copy link
Contributor

avalonv commented Oct 1, 2022

I can confirm on Windows that the same issue occurs, but is rather a git issue:

1. Rename a tracked file (Desktop shows add/delete):

@sfadschm did you use git mv or rename through the GUI? (I don't know Window's equivalent of mv).

If the latter, that's not a git issue, it has no way of knowing you renamed a file unless you explicitly tell it you did.

@avalonv
Copy link
Contributor

avalonv commented Oct 1, 2022

Also secondly this feature would be really awesome.

I found with my workflow I keep having to switch to the terminal to rename files manually with git mv. It would be unfair to expect Github Desktop to provide an interface for every single git command, but support for renaming is pretty basic and should be there.

@sfadschm
Copy link

sfadschm commented Oct 2, 2022

I used the Windows Explorer for renaming.

I did not try git mv, but I would guess that files changed by this colmand will be displayed as a rename correctly, as they will be staged automatically.

@lat9
Copy link

lat9 commented Apr 25, 2023

FWIW, I'll note that Atlassian SourceTree properly uses the 'git' renaming instead of a delete/add, keeping the history of the renamed file.

Other than this 'move backwards', I've found GitHub Desktop to be more reliable that SourceTree.

@slingshotvfx
Copy link

slingshotvfx commented Jan 28, 2024

+1 coming from SourceTree it's an annoying issue to not be able to move or rename files in vs code or windows explorer and keep their history in tact.

nataliejschultz added a commit to MukuFlash03/e-mission-server that referenced this issue May 22, 2024
Removing the inconsequential change from the last push and renaming manually. This was my issue: desktop/desktop#13588
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants