Skip to content

Tag Archives: git

Git: When to Close (Delete) Branch after PR


When should I close (i.e. delete) the branch after a successful pull request? Rule of thumb: always. (There are exceptions of course.) What if I need to recover the deleted work? You'll just git checkout -b <branch> <sha>  

Conflicting package-lock.json in Git?


Include package-lock.json in your git repository, but try to commit it alone (to avoid noise in diffs). When encountering conflicts during merge: npm install --package-lock-only As running that command then suggests, you might also want to consider automating the process by installing npm-merge-driver (npx npm-merge-driver install -g).

Cancel Conflicting Git Merge (--ABORT)


Your keyword here isĀ abort. git merge --abort

Search All Git Branches for Specific Text/Regex


git branch -a | tr -d \* | sed '/->/d' | xargs git grep [string or regex] This can be slow, though, and git log may be more effective. git log -p --all -S 'search string' git log -p --all -G 'match regular expression' This produces list of commits, so we need to find branches […]