DEV Community

Cover image for Lost your README?
Fion L
Fion L

Posted on

Lost your README?

When this happens, this is kind of a loss of a mojo as well and this has happened to me a lot.
I am had to do a git push -u origin master and then the commit was rejected. Has this happened to you too? Fret not.

Image courtesy of http://Studytonight.com.

I stumbled upon a post on Stackoverflow on how this should be done:
https://stackoverflow.com/a/59790434/11083275. which irons out the problem entirely.

  1. Can't push.
  2. What did I do? git push -f origin master
  3. Why did I do that? To upload my last commit!
  4. What was the consequence? Well everything was loaded but for every readme I did from my last lot of commits!
  5. How to put that right? As per the article above, the next steps would be...
- git fetch origin master
- git pull origin master
- git add .
- git commit -m 'your commit message'
- git push origin master
Enter fullscreen mode Exit fullscreen mode

If you now check your github you should find that master to master was successful.✅

Ok everyone, have fun 😂!!

Top comments (1)

Collapse
 
fion21 profile image
Fion L

Just tried that, it works!!