is_branch_changing_command

Function is_branch_changing_command 

Source
pub fn is_branch_changing_command(command: &str) -> bool
Expand description

Check if a shell command might change the git branch.

Returns true for commands like:

  • git checkout <branch>
  • git switch <branch>
  • git worktree add <path>
  • git merge <branch> (in case of fast-forward)
  • git rebase <branch>

This is a heuristic and may have false positives/negatives.