2 ms·
personally - skip the 'git add .' It's a pretty terrible habit to get into, and will (not can - will) cause all sorts of headaches. From minor ones like perso
by horsawlarway 1y ago
personally - skip the 'git add .'
It's a pretty terrible habit to get into, and will (not can - will) cause all sorts of headaches. From minor ones like personal editor configs getting dumped into the projects, all the way up to major ones like secrets ending up in your git history.
If you want something close, but much better, do something like:
if [[ -n $(git ls-files --others --exclude-standard) ]]; then
echo "There are untracked files. Please add, remove, or ignore them."
else
git commit -am "descriptive name"
git push
fi
- the__alchemist 1y agoI see your point, but find it worth it for convenience. Ultimately git is a tool I use to get the job done, and I want it out of the way. 99% of the time, I just want to sync my project, which doesn't only mean edits to existing files.
- open-paren 1y agoHow about `git add --patch -all` to make it interactive? I have that aliased to `gap` and it is probably my most used git command.
- cholantesh 1y agoThat sounds better but I like the granularity I get from scrutinizing specific files or the patch takes too long to review.