0

There is a tracked file that we do not need anymore. I deleted the file on my local repository. So what are the git commands to write in order for the action to be effective on the remote repository ?

pheromix
  • 18,213
  • 29
  • 88
  • 158

1 Answers1

1

Untrack the file

If you don't want git to track a file you have to can untrack it with

git rm --cached filename

Then you will need to commit the changes locally with:

git commit

After that you can push the changes to the remote with:

git push

Delete the file

If you want to delete a file, simply remove it from the repo.

Add the changes with:

git add -A

You can check the changes with git status:

On branch main
Your branch is up to date with 'origin/main'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        deleted:    file.md


Then you can commit your changes with:

git commit -m "Removed the file"

To push the changes on the remote:

git push
Atropo
  • 12,231
  • 6
  • 49
  • 62