u/birdsintheskies

▲ 1 r/git

Does cherry-pick *always* expects a clean working tree?

I know I can stash and do this, but I'm just wondering what cherry-pick actually expects.

I currently have two unstaged files. The commit that I want to cherry-pick will touch neither of these files, so I don't know why it complains "your local changes would be overwritten by cherry-pick".

If I do cherry-pick --no-commit then the change is cleanly applied, so I'm thinking why it can't just commit that instead of me having it write the commit in an additional step.

I think if there was nothing staged before the cherry-pick, and the files being overwritten by the cherry-pick are the same as in the cherry-picked commit's parent, then it should've worked. The state of the other unrelated files shouldn't matter.

Is this just git being extra cautious and not wanting to deal with any potential edgecases? I'm trying to understand what's the worst thing that can happen if I were to implement this in a script/alias.

reddit.com
u/birdsintheskies — 3 days ago
▲ 1 r/git

Just like submodules, is there a way to add just a single file and track upstream?

I need a single file that is in another repository. If I just add the file as-is, I don't know when the upstream repository updates the file. What is the best way to handle this?

reddit.com
u/birdsintheskies — 6 days ago
▲ 3 r/git

Is there a catch-all command dispatcher in git-shell?

I have added a new user with the default shell set to /usr/bin/git-shell and I've set up a welcome message as per the documentation and this is working so far.

I tried implementing a custom command in ~/git-shell-commands, and that works too. So far, so good.

Now, I'm looking to allow only the git upload-pack command, but I didn't find a way to do that, and I didn't find some something that can dispatch commands so I can add some logic to allow/deny the request.

I looked at shell.c in the git source, and it appears like (I'm not sure) it should've worked if I had a script called receive-pack that simply did an exit 1 but that didn't work.

Am I supposed to run a modified version of git-shell, or is there a more cleaner way?

reddit.com
u/birdsintheskies — 7 days ago