"Nothing to Commit (Working Directory Clean)" When a Folder Has Been Added

git status (nothing to commit, working directory clean), however with changes commited

Your local branch doesn't know about the remote branch. If you don't tell git that your local branch (master) is supposed to compare itself to the remote counterpart (origin/master in this case); then git status won't tell you the difference between your branch and the remote one. So you should use:

git branch --set-upstream-to origin/master

or with the short option:

git branch -u origin/master

This options --set-upstream-to (or -u in short) was introduced in git 1.8.0.

Once you have set this option; git status will show you something like:

# Your branch is ahead of 'origin/master' by 1 commit.

Troubleshooting misplaced .git directory (nothing to commit)

Found what was wrong. I don't understand how, but .git directory path somehow was changed to other path than I was working in. So then anything I changed was not checked, because git was checking in other place. I noticed it, when I reinitialized it and it showed that it reinitialized entirely different directory. When I cd .. from my current directory and cd to it back again and then reinitialized yet again, then it switched back to correct .git directory and started seeing my changes.

Git:nothing added to commit but untracked files present

You have two options here. You can either add the untracked files to your Git repository (as the warning message suggested), or you can add the files to your .gitignore file, if you want Git to ignore them.

To add the files use git add:

git add Optimization/language/languageUpdate.php
git add email_test.php

To ignore the files, add the following lines to your .gitignore:

/Optimization/language/languageUpdate.php
/email_test.php

Either option should allow the git pull to succeed afterwards.

why git status shows working directory clean even after I add a new file

the command git status doesn't require an argument. The argument branchABC that you provided is interpreted by git-status as a path. So git checks the status of a file or directory named branchABC. Solution: just use one of the following commands:

git status
git status -b

in the git-status man page: git status [<options>...] [--] [<pathspec>...], and since branchABC is not a valid option; it is interpreted as pathspec. I agree that maybe git could have put a warning that there is nothing matching the path branchABC...

I tested this locally.

$ git status
# On branch test
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# spec/a
# src/a

$ git status src
# On branch test
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# src/a

$ git status non-existing-path
# On branch test
nothing to commit, working directory clean

Nothing to commit, working directory clean message when trying to commit

Try cloning the repo you created on Github by executing this in your working directory:

git clone https://github.com/khpeek/jumpstart-blogger.git

Then run this:

git status

See, if your files are there and not added yet, then run:

git add .
git commit -m "First Commit"

Finally, check git status again!

Hope I helped...



Related Topics



Leave a reply



Submit