Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Beginner Question: How can I update my commits?

In my GitBash, I edited the commits until there’s only four left.

Image 1

That is because I want to like update what’s on our website and get rid of those other two about me files.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Image 2

I tried to directly push it, but it it says this.

Image 3

Is there a quick way to do it?

>Solution :

Since you effectively rewrote history, git will not allow you to simply push the new truth. You will need what is called a "force push", described here: https://git-scm.com/docs/git-push#Documentation/git-push.txt—no-force-with-lease.

Please note that git push --force-with-lease origin master means all checks are skipped, and you may therefor lose commits. In this case though, that seems to be what you are intending to do (removing a few commits) so it’s OK.

Please make double and triple sure that you’re pushing exactly what you want to push. If you don’t have a copy of the repository elsewhere, then this might be a tricky thing to revert.

Also, do not use --force-with-lease with every push, only when you really need to.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading