How to clean this Deleted from git

Asked

Viewed 163 times

0

Friends I had a file in the local repository. I deleted and when giving git status the history is like this:

$ git  status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    deleted:    testeGit.java

How do I clean it? make it cute, clean. I don’t want the local file anymore, I want it only on github.

1 answer

1

Any changes you make, add new file, remove, edit..

git add -A

Then does the Commit

$ git commit -m "Arquivo removido testeGit.java"

See the State

$ git status
On branch master
nothing to commit, working tree clean

Updating: As commented by @nunks-lol, using the command below saves you from using the command git add -A

git rm _arquivo_
  • 2

    As the goal is to put in "Stage" the deletion of a file, you can also use the git rm _arquivo_ and "spare" a git add...

  • That I didn’t know, because I hardly use the git, vlw.

  • 1

    I’m from the tribe of purists who say, "use git add -A is harmful laziness". Not that it should be avoided as the devil flees from the cross, but it usually infringes concepts such as atomic commits and a better separation from code changes. A properly commited code allows easier commit exchange via cherry-pick, as well as it is easier to observe the process used in its evolution for reasons of revision and code history

  • 1

    @Jeffersonquesado I’m always learning here with you :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.