I’m trying to pass a parameter through a pipe in terminal for a git command, and, as per usual, I don’t know what I’m doing.
Currently: git rm --cached folder/path | rm -rf folder/path | git commit -m '...'
I would like to not have to repeat myself with the folder path in the second command if possible, but I’m not sure how to get the folder/path from the first command.
Is it even possible, or am I barking up the wrong tree?
You shouldn’t need to do pipe.
Learning the bang (!) operator in bash is very worthwhile. Specifying a long path again isn’t the best.
For most of my workflow, I can get away with this:
If I’m fixing up a previous commit which mistakenly added the file that I didn’t want, you can amend that commit by changing the last commit in the above code snippet to
This will reuse the message from the current commit.
You might want to include the output of your git status and what you’re trying to do.