1.First Way
Go back to previous commit (keep changes in working directory)
git reset --soft HEAD~1
Add your missing files
git add missing-file.txt
Commit again with all files
git commit -m "Your original commit message"
Force push to update remote branch
git push --force-with-lease
2.Second Way
- Alternative: Amend the last commit
git add missing-file.txt
git commit --amend --no-edit
git push --force-with-lease
3.Third Way
- If you already pushed and want to be safer
git add missing-file.txt
git commit -m "Add missing files"
git push
Top comments (0)