git question
I am trying git for a programming project and It keeps saying that I have to "git add" all the files i've modified since the last commit, and it's getting on my nerves.
Is that really true? If so what's the purpose? |
Quote:
|
I added those files before and did not change their names. I just modified their contents.
Code:
$ git status |
Quote:
then i read git help commit. it will do git add then git commit. first adding to tree then committed (from DOCs (git help commit) Note: even modified files must bb "added"). this explains the behavior. |
So "git commit -a" does what I want and does not add new files that I might not want version-controlled, right?
|
Quote:
and use .gitignore for files should not be version controled |
Quote:
What does that mean? |
Quote:
|
So I should remember every file I modified and add it before every commit? There really isn't an easier way?
|
Quote:
|
If it adds automatically, then why would I be asking this?
|
Quote:
|
I asked this question because for some reason modifying the contents of a file and running "git commit" did not commit the changes.
|
Quote:
Code:
man git-commit Quote:
|
Quote:
|
Quote:
Quote:
|
Git is different from SVN. Committing is a two-stage process first you stage items you plan to commit with git add and then you actually commit them with git commit.
It's a different program; it works differently. |
I'm surprised no-one has said this yet (or maybe they did, and I didn't notice it): when you are ready to "git commit", you don't have to add each individual file, one-by-one - just go into the top directory in your source tree, and run:
Code:
$ git add . Code:
$ git commit [[-a] -m 'commit message'] Code:
$ git push remote branch_name |
"git add ." probably won't work for you if you have files that you don't want git to track.
|
Quote:
|
All times are GMT -5. The time now is 05:52 PM. |