Clean up Git after Drupal module update

  |   Source

If you upgrade a Drupal module using Drush, you get may get new files and/or some files will be modified. It may also delete files that are no longer needed.

To get clean git status, you need to do a two stage commit:

git status

shows all the new, modified and deleted files. Add all the files to the git repository:

git add .

to stage all the new and modified files:

git commit -m "Upgraded Module to version X.X"

will commit all the new and modified files.:

git status

now shows only the deleted files To stage all the deleted files:

git add -u

This will stage the deleted files for removal. Then do a second commit to remove the files:

git commit -m "Remove deleted files after upgrade"
Comments powered by Disqus