Add new file to commit

Asked

Viewed 2,783 times

5

How do I add new files to a commit already done in Git without creating a new commit?

If you have already pushed to the remote server, like "re-commit"?

2 answers

9

If you do --force, and other authors have created new commits however, these commits will be permanently erased. --force is recipe for disaster and should be avoided at all costs.

--amend is recommended only if the commit has not yet been published.

Since in this case the commit has already been published, it’s best to create a new commit with the new files. amend is to rewrite history, is lie to git.

6


Browser other questions tagged

You are not signed in. Login or sign up in order to post.