Move a file/directory but still merge changes easily?

前端 未结 3 900
轮回少年
轮回少年 2021-01-03 23:17

I\'ve read in various FAQs that git doesn\'t explicitly track renames/moves, preferring to look for identical (or in some situations similar?) files. That\'s gr

3条回答
  •  礼貌的吻别
    2021-01-04 00:17

    Alternatively, rename the files using mv, and invoke git add --all to stage all the delete operations and add the untracked files (the new file names). Without --all, you must explicitly stage the delete operations and new file names separately. Don't use git add --update, either, as this will stage all the delete operations, but won't add the new file names.

    Note that you'll likely want to perform these operations in a local branch so that you don't inadvertently push them to your friend's master branch or your friend doesn't pull them into his master branch.

提交回复
热议问题