0

I'm newly at git and I tried to study this useful cvs.

But I pushed some project to the remote repository and I want to update state and push this changes.

before this I want to add all changes that are done.

But when I run git add . - it doesn't do nothing.

The status are the same as before I have run this command.

Here is more info:

nazar_art@nazar-desktop:~/workspace/NewYearGift$ git st
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#   new file:   .classpath
#   new file:   .project
#   new file:   .settings/org.eclipse.core.resources.prefs
#   new file:   .settings/org.eclipse.jdt.core.prefs
#   new file:   .settings/org.eclipse.m2e.core.prefs
#   new file:   README.md
#   new file:   logs/new-year-gift.log
#   new file:   output/GiftList_1387287018363.xml
#   new file:   pom.xml
#   new file:   src/main/java/com/epam/lab/controller/GiftController.java
#   new file:   src/main/java/com/epam/lab/model/ItemGiftBuilder.java
#   new file:   src/main/java/com/epam/lab/model/ItemGiftParser.java
#   new file:   src/main/java/com/epam/lab/model/NewYearGift.java
#   new file:   src/main/java/com/epam/lab/model/sweets/Caramel.java
#   new file:   src/main/java/com/epam/lab/model/sweets/Chewy.java
#   new file:   src/main/java/com/epam/lab/model/sweets/DarkChocolate.java
#   new file:   src/main/java/com/epam/lab/model/sweets/DesertChocolate.java
#   new file:   src/main/java/com/epam/lab/model/sweets/Generator.java
#   new file:   src/main/java/com/epam/lab/model/sweets/Halva.java
#   new file:   src/main/java/com/epam/lab/model/sweets/MilkChokolate.java
#   new file:   src/main/java/com/epam/lab/model/sweets/PorousChocolate.java
#   new file:   src/main/java/com/epam/lab/model/sweets/Sweets.java
#   new file:   src/main/java/com/epam/lab/model/sweets/SweetsGenerator.java
#   new file:   src/main/java/com/epam/lab/model/sweets/Waffles.java
#   new file:   src/main/java/com/epam/lab/model/sweets/WhiteChocolate.java
#   new file:   src/main/java/com/epam/lab/view/Application.java
#   new file:   src/main/java/com/epam/lab/view/Main.java
#   new file:   src/main/resources/log4j.properties
#
nazar_art@nazar-desktop:~/workspace/NewYearGift$ git add .
nazar_art@nazar-desktop:~/workspace/NewYearGift$ git st
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#   new file:   .classpath
#   new file:   .project
#   new file:   .settings/org.eclipse.core.resources.prefs
// the same thing

I couldn't figure out why this happen?

It should add all changes, but it ignore all...

Any suggestion?

2 Answers 2

2

Your git add . worked as expected - it recorded your intent to add files of interest into index. But, in order to finalize your addition, you need to commit: use command git commit, which will create commit object, and you will be able to actually push your change using git push.

Note: you probably did not want to add files like logs/new-year-gift.log or .settings/org.eclipse.core.resources.prefs. I would recommend to remove them from your list using git reset, like this:

git reset logs/ .settings/

and maybe create .gitignore with content like this:

.settings/
*.log
Sign up to request clarification or add additional context in comments.

2 Comments

for .gitignore it only create file and write at new line every time?
You create .gitignore once (and commit it for good measure). You can keep adding file masks you want git to completely ignore into it in the future.
0

You actually have added the files already. Git has a concept of a staging area (also called the "index"), which is where files are placed before being committed. So, a typical workflow would be:

  1. Work on your code
  2. Run git add to add files into the index.
  3. Run git commit to actually commit the changes staged in the index into the repository.

This is useful for when you wish to selectively add things to your commit, piece by piece.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.