So I've taken over a website, some of which has been under git version control (one of the devs used it, the other didn't). So I'm going to commit everything so far, and work from there.
However, there are a few files with a git status which I don't quite understand. They are labelled as:
# Changed but not updated:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
So if I simply run git commit, will the changes made to these files work their way in to the repository? It's just I don't get why you would do add/rm- seems like adding and then removing all in one foul swoop.
Thanks for your help!
Usually, if you want to take things as they are in the working folder you would
git add -A
which would stage all changes including the act of deleting a file and of tracking files that were not tracked yet.
It is wise to review your .gitignore
file before doing this so you don't commit unwanted artifacts which can bloat your repository and pollute the output of diffs and patches.
Once you have done this you can
git commit
to record the changes in history. Then you can
git push origin your_branch_name
to share this new history with the remote you set up.
These files are staged but not committed. Yes, if you simply run git commit, they will be committed. More to the point, do you want to commit these files? They may or may not be the same as your working files. http://gitready.com/beginner/2009/01/18/the-staging-area.html is a decent introduction to the staging area.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With