skip to Main Content

I´m developing a project using github and visual studio github extension.

I uploaded a running version of the code and keep on developing

In the meanwhile, some other coder updated the git files with plenty of errors and then basically disappeared. My local version is still Ok. I want to upload MY LOCAL version of the code, which includes the old state plus changes

So what I want is to push my files ignoring anything in the repo. I could even just create a new one but I have some pipelines and would be a bit of a mess.

I guess another valid approach is to revert all new commits he did and once GIT is in the state of my last commit, then procede to do standard commit from VS.

But github desktop or VS git extension doesn’t allow me to do so.

Any clue?

PS: I´ve never use git on command line so if the solution goes through this.. please be very detailed on your answer 🙂

2

Answers


  1. In VSCode go to your git and … than Changes and do Stage All Changes. After that you can check each file and push the verion you want.

    That worked for me.
    Hope it helps

    Login or Signup to reply.
  2. It is easier to open a CMD terminal in your VSCode, at the root folder of your project (which should be the root folder of your repository) and type, assumuing you are both working on main:

    git add .
    git commit -m "Commit everything locally"
    git fetch
    git merge --ours origin/main
    git push
    

    See "Why would one use "git merge -s ours"?": the idea is to ignore the changes pushed to origin/main and keep your local main content.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search