2

I added an empty folder named "test" in master folder and I want to update my github.

I typed

git add .
git commit -m "all file"

and it show

#On Branch master
nothing to commit, working directory clean

Why?

7
  • 2
    Did you add/change any files into/in the repo? Commented Aug 21, 2013 at 8:43
  • 2
    you might be modifying files of type specified in .gitignore Commented Aug 21, 2013 at 8:45
  • If you've added files and merged, then there are no changes, so your status should be showing as clean. What exactly is the problem? Commented Aug 21, 2013 at 8:49
  • Now, I want push them to git hub, but I couldn't. Commented Aug 21, 2013 at 8:51
  • 6
    Git does not track empty folders. you said you created a folder -- but didnt mention any files in it. if there are none, git will ignore the folder Commented Aug 21, 2013 at 9:02

3 Answers 3

10

Git does not track directories. It tracks files. Directly from Git FAQ (emphasis added)

Can I add empty directories?

Currently the design of the Git index (staging area) only permits files to be listed, and nobody competent enough to make the change to allow empty directories has cared enough about this situation to remedy it. Directories are added automatically when adding files inside them. That is, directories never have to be added to the repository, and are not tracked on their own. You can say "git add " and it will add the files in there. If you really need a directory to exist in checkouts you should create a file in it. .gitignore works well for this purpose (there is also a tool MarkEmptyDirs using the .NET framework which allows you to automate this task); you can leave it empty or fill in the names of files you do not expect to show up in the directory.

So as the FAQ suggests, if you really need to add an empty directory to your repo you can create any file in it. I usually put an empty .gitkeep file inside the empty folder I want to track and that allows me to add it to the repo.

Sign up to request clarification or add additional context in comments.

Comments

0

first use

git add [files]

http://git-scm.com/docs/git-add

then

git commit -m "your comment"

GIT has excellent documentation http://git-scm.com/book/en/Git-Basics-Recording-Changes-to-the-Repository

1 Comment

If there are files that need to be added, they would have shown up in the result of git status. This isn't really an answer the the problem. Actually, we don't even know what the problem is.
0

did you change anything in the folder. git status is used to show the changes you have made in repo since last commit.

or may be the files you changed are included in the .gitignore file in the repo folder

update1:

if you want to know the changes either use git diff mybranch..master to know the differrence betwween two branches or you can also use graphical difference tool such as gitk, gitg. you can install these by command apt-get install gitk

graphical differenc tools:

$ gitk
$ gitg

2 Comments

I create a branch and add some file and then merge to master branch.that is all I did.
@LateBloomer if you commited the changes and merged then nothing will shows in status. if you want to know the changes either use git diff mybranch..master to know the differrence betwween two branches or you can also use graphical difference tool such as gitk, gitg. you can install these by command apt-get install gitk

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.