After pushing my code to the remote branch and creating a PR. I wanted to make some more changes to my code and then commit to the remote branch again
First, I started these steps:
git add .
git commit -m "Remove semicolons, change to multi line returns"`
But then this appeared right after the commit:
I checked the status and unstage all the added files
git status
git restore --stage .
-> Then I add and commit again, the error is still there.
After that, I undo the commits & pull the branch to start again
git reset HEAD^
git pull
When I'm done making changes to the code, I ran git diff
to see the changes I've made.
Finally, I ran git add .
& git commit -m "Recommit message"
, but somehow the error came back
Can anyone help me with what actually happened and how can I fix it?
If we can't fix it, is there any way to revert the code to normal?
Thank you!
git pull
. It shows: "On branch responsive_header. Your branch is ahead of 'origin/responsive_header' by 2 commits. (Use git push to publish your local commits). Nothing to commit, working tree clean" – Submariner"Nothing to commit, working tree clean"
means just that. There is nothing to commit. – Wendallgit add .
and commit again but it said "No staged files found". Then I make changes & add, commit again like I mentioned in the question above. It results to the same error – Submarinergit status
,git add
,git commit
where you have changes? It might be that there is a bug in your lint hook. – Alexipharmicgit restore...
– Wendallhusky: {...}
)? You probably have some kind of linter which fires just before your files are commited (via husky). When changes are small enough and linter fixes them for you, from git perspective nothing changes, hence thisprevent empty commit
error shows. – Episcopalian