1

Is it possible to commit changes to another branch without checking it out?

Otherwise I always have to checkout my branch first and commit to it, which causes the deployment to run and revert everything to match the checked out branch.

Is there a command to commit directly into the branch e.g.

git commit --branch='my_target_branch' -m "commit description" -m "more details"
Black
  • 18,150
  • 39
  • 158
  • 271
  • I honestly don't know. I wonder if @torek might. – evolutionxbox Jun 27 '18 at 08:36
  • 3
    *"which causes the deployment to run"* -- this is where the trouble is. You should not deploy from your development repository but from a clone (preferably bare). The deployment can be triggered manually, by a Git hook when you push or by a cron job that runs often enough. – axiac Jun 27 '18 at 08:43

0 Answers0