Do I commit the package-lock.json file created by npm 5?

Yes, package-lock.json is intended to be checked into source control. If you’re using npm 5+, you may see this notice on the command line: created a lockfile as package-lock.json. You should commit this file. According to npm help package-lock.json: package-lock.json is automatically generated for any operations where npm modifies either the node_modules tree, or package.json. … Read more

How do I delete all Git branches which have been merged?

NOTE: You can add other branches to exclude like master and dev if your workflow has those as a possible ancestor. Usually I branch off of a “sprint-start” tag and master, dev and qa are not ancestors. First, list locally-tracking branches that were merged in remote (consider using -r flag to list all remote-tracking branches). … Read more

Ignore files that have already been committed to a Git repository [duplicate]

To untrack a single file that has already been added/initialized to your repository, i.e., stop tracking the file but not delete it from your system use: git rm –cached filename To untrack every file that is now in your .gitignore: First commit any outstanding code changes, and then, run this command: git rm -r –cached … Read more

How do I change the author and committer name/email for multiple commits?

NOTE: This answer changes SHA1s, so take care when using it on a branch that has already been pushed. If you only want to fix the spelling of a name or update an old email, Git lets you do this without rewriting history using .mailmap. See my other answer. Using Rebase First, if you haven’t … Read more

I ran into a merge conflict. How do I abort the merge?

Since your pull was unsuccessful then HEAD (not HEAD^) is the last “valid” commit on your branch: git reset –hard HEAD The other piece you want is to let their changes over-ride your changes. Older versions of git allowed you to use the “theirs” merge strategy: git pull –strategy=theirs remote_branch But this has since been … Read more