Commit a file to a Different Branch Without Checkout

前端 未结 10 2098
南方客
南方客 2020-12-05 09:55

Is it possible to commit a file in a git branch with out checking out that branch? If so how?

Essentially I want to be able to save a file in my github pages branch

10条回答
  •  悲哀的现实
    2020-12-05 10:27

    I made a little tool that does exactly this: https://github.com/qwertzguy/git-quick

    It let's you edit specific files from another branch without checking out the other branch completely (just the files you want to edit) and commit them. All this without ever affecting your working copy or staging area.

    Behind the scenes it uses a combination of git worktree and sparse checkout. The source is fairly small, so you can read through.

提交回复
热议问题