I ran the following command:
git push -u origin master
The "push" was very big, many files, so it was taking time to upload. Halfway through I noticed I forgot to add a couple of files. So I did "Ctrl + C"
in terminal (interrupting Git), and then after doing git add .
, I committed again, and then pushed again.
Will Git know that the first one didn't go through ? It takes a really long time to push (so I can't test it easily. I have to wait for the push to finish which could take a while).
EDIT: Hooray! Nothing seems to have gone terribly wrong. All I did was push again, and everything works. :{
If you wish to completely avoid push --force , both GitHub and GitLab offer a very cool feature called Protected Branches, which allows you to mark any branch as protected so no one can push --force to it.
A commit gets rejected and causes a failed to push some refs to error because the remote branch contains code that you do not have locally. What this means is that your local git repository is not compatible with the remote origin. Based on the above, your local machine is missing commits C and D.
So commiting changes without pushing allow the save-load behaviour done locally during development. Once you are happy with your work, you then commit AND push.
In order to delete a remote Git tag, use the “git push” command with the “–delete” option and specify the tag name. To delete a remote Git tag, you can also use the “git push” command and specify the tag name using the refs syntax.
The upstream Git repository will be oblivious to your attempted push, and no change will occur upstream. Unfortunately however, as it doesn't do anything with the half-pushed files, it doesn't store it and then expect a continuation of the push later on either. So it's either push or don't push, there is no try;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With