简体   繁体   中英

Select a file to be tracked by git

I would like git to track a file, site.db , that is currently not tracked because I ran git rm --cached site.db

Since running that command I have made a few changes to the file and I would like to push it to a remote repository.

How can I do this?

When I run git status , it returns:

git status
On branch master
Your branch and 'origin/master' have diverged,
and have 52 and 1 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        deleted:    denise/site.db```

I'm worried that if I `push` then `denise/site.db` will be deleted, when I actually want to push it!

If you do git add of that file it should readd it

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM