I am trying to make powershell commands for git commands using variables, but I cannot make it work when I add Replace function.
$branch_task = 'TEST_01'; $branch_title = 'some_branch_title'; git checkout -b feature/"$branch_task"_"$branch_title"
this one gives success command: git checkout -b feature/TEST_01_some_branch_title
git commit -m ""$branch_task": "$branch_title""
this one gives success command: git commit -m "TEST_01: some_branch_title"
but this one:
git commit -m ""$branch_task.Replace('_', '-')"':' "$branch_title.Replace('_', ' ')""
gives error:
error: pathspec ': ' did not match any file(s) known to git
error: pathspec 'some branch title' did not match any file(s) known to git
Any ideas?