I commit the file with this.
git add .
git commit -am 'all'
However after this, I notices that I added the wrong file(too big).
So put this line in .gitignore
*.sql
However after this *.sql
file is not removed from git.
And git push origin master takes too long time.
What can I fix for this?
CodePudding user response:
You can use git reset --soft HEAD~
to undo the last commit which hasn’t been pushed.
Be careful when putting *.sql in the .gitignore, that prevents you from committing sql files in the future and you might not want that
CodePudding user response:
The simplest thing you can do is remove the file from index and then amend... that will remove the file from the revision (actually, you create a new revision)
git rm --cached the-sql-file # this _won´t_ remove the file from the working tree because of --cached
git commit --amend --no-edit
# now you can push