6

Is it possible to rename a file using Github desktop instead of using git shell and keep the history of it?

thanassis
  • 807
  • 1
  • 8
  • 23

2 Answers2

6

git mv oldname newname

does exactly what you want.

EDIT: Point is that I don't think the github Desktop client lets you do that. To be honest, I see less and less usage for Github desktop, seeing that a) the website of github lets you do more things directly online in your fork on their servers, and b) git integration into almost any IDE is available and c) github desktop might hide a lot of the details of handling git, but it does the "wrong thing" in my humble opinion, not only taking away complexity, but adding confusion to the mix, and d) Github's own tutorial doesn't even mention it

Marcus Müller
  • 27,924
  • 4
  • 40
  • 79
  • 1
    I agree and thank you for your reply.. this mean that is not possible using Github desktop UI but git shell command. – thanassis Dec 16 '15 at 11:42
  • Ah sorry, I misunderstood. – Marcus Müller Dec 16 '15 at 11:43
  • Sorry what do you mean "adding info"? – thanassis Dec 16 '15 at 11:46
  • 1
    It is quite risky using github desktop for more complicated thing because I just rename a file and I lost history. It recognizes changes but it can not merge old and new file. We must to it as you suggest! – thanassis Dec 16 '15 at 11:53
  • @thanassis: that sounds unlikely. the desktop client doesn't keep history itself, it just uses git underneath. Git knows how to handle renames, so if you just ignore what the desktop client says, you should be fine. – Marcus Müller Dec 16 '15 at 13:38
  • short answer: no it isn't possible from Git Desktop – Thierry Dalon Apr 26 '19 at 18:34
  • GitHub Desktop _is_ able to properly detect when you rename a file using git. The icon turns into a blue arrow instead of red minus and green plus. Maybe they plan on adding a rename feature to the app in the future? What I don't understand is if git is necessary to do things in the correct way, why Git Shell or whatever is not installed along with GitHub Desktop by default. It is not even available for download from the GitHub website! They would save so much space on their servers I think by eliminating these duplicated files. – posfan12 Jan 31 '20 at 21:38
  • Also, can you recommend a better GUI shell than GitHub Desktop that can rename files? – posfan12 Jan 31 '20 at 21:52
1

Short answer is no, it isn't possible from Git Desktop. You have to use the command line or the web access (only works for some files). See docu https://help.github.com/en/articles/renaming-a-file

Thierry Dalon
  • 581
  • 4
  • 20