diff --git a/README.md b/README.md index ca02a0c..d0f8c3d 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,13 @@ $ git add myfile $ git commit --amend --no-edit ``` +In case the file was newly added to the commit and you want to remove it (from Git alone), do: + +```sh +$ git rm --cached myfile +$ git commit --amend --no-edit +``` + This is particularly useful when you have an open patch and you have committed an unnecessary file, and need to force push to update the patch on a remote. The `--no-edit` option is used to keep the existing commit message.