github - Difference between git push -f origin master and git push origin master --force? -


today, trying permanently delete file in commits using git filter-branch. after, needed force push obviously, in order ensure collaborators have access repository without file.

so, tried git push -f origin <branch-name>, gave me usual "make sure have correct access rights" error.

so, did following commands:

git push -f origin <branch-name> git checkout <branch-name> git push origin <branch-name>:<branch-name> --force 

after git push origin master --force , worked. why , how different? thanks.

there no difference between git push -f <remote> <branch> , git push --force <remote> <branch>. -f shorthand --force.

git checkout <branch-name> checkouts out <branch-name>. since you're specifying branch wanted push, didn't have effect.

git push origin <branch-name>:<branch-name> --force pushed commits in local <branch-name> remote's <branch-name>. same git push origin <branch-name> --force since branch names same.

if got access error 1 not other, didn't use right credentials.

https://git-scm.com/docs/git-push


Comments