Forum Discussion

filipkowal's avatar
filipkowal
New Member
9 months ago

Github Push overwrites Readme.md

Every time I push to a specified Github branch the Readme.md is overwritten with an empty file.

I don't see any reason for it, therefore I assume it's a bug.

It's annoying. Is there any fix for it?

2 Replies

  • chichepo's avatar
    chichepo
    Champion Level 3

    Hi filipkowal 

    Indeed, your Github integration settings is specifying the folder where changes will take place:

    In my case all files under "files-output" will be overwritten.


    However, if you put your file under the project root (in my case "OAS3"), it will not be overwritten.

    Another solution could be to use an "advanced sync" and then to set the relevant path:

    Let us know


     


     

  • Hey everyone,

    I ran into an issue recently where my GitHub pushes were overwriting the Readme.md file in my repository. I thought I'd share my experience and the solution I found.

    It turns out that GitHub considers the latest version of the file in your local repository as the source of truth. So, when you push changes, if your local Readme.md is different from what's on the remote, it will replace the remote version with your local one.

    To avoid this, here's what I started doing:

    Always Pull Before Pushing: Before making any changes, I ensure to pull from the remote repository. This way, I get the latest version of Readme.md and minimize the chances of overwriting.
    Branching: I create a new branch for each feature or bug fix. This keeps the master or main branch stable and reduces conflicts when pushing changes from different sources.
    Commit Frequently: I commit my changes frequently to my local branch. This way, I can always refer back to a previous version if needed and reduce the chances of a major conflict during push.
    Review Changes: Before pushing, I review the changes I've made to the Readme.md file. This ensures I'm not accidentally overwriting something important.
    Remember, it's always a good practice to keep backups of your important files, including the Readme.md. Mistakes can happen, but with the right precautions, we can avoid unnecessary hassle.

    Hope this helps others facing a similar issue! If you have any other tips or suggestions, feel free to share.

    Cheers!