Post

absolutely baffled by the fact that there seems to be no way of staging individual line changes (rather than whole files) in git without going through an interactive/GUI mode 🥴 why why why can i not `git add my_file.txt --lines=5-10` ???

0 reposts0 likes

You can approximate this with "git apply" 1. Dump the diff to a file: git --no-pager diff myfile.txt > /tmp/stageme 2. Edit the temporary file, either in your text editor or with a script that leaves only the chunks you want. 3. Stage those chunks: git apply --cached /tmp/stageme