0

I am using windows git bash.

I have a folder c:/myrepo and I have changed the directory to this folder in the Git Bash window. I executed the following command inside this folder

git clone https://dev.azure.com/myproj/_git/proj1

if I execute the command ls I see a directory proj1. The proj1 directory is empty because there are no contents yet.

I am copying a few directories, with some files inside those directories from another directory to the proj1 directory with the following command

cp -a C:/Projects/source/. C:/myrepo/proj1

There is no .gitignore file in any directory. Now, if I execute the command git status I see the following output

On branch master Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

I do not understand why git is not showing untracked directories and files I have copied.

EDIT

Based on the suggestion given at the SO thread Why doesn't git recognize that my file has been changed, therefore git add not working I executed the following steps.

I removed all the directories/files from proj1 diretory and then executed the following commands

git update-index --no-assume-unchanged .

and then

git rm --cached . -r

I copied back all the directories/files into proj1 folder. When I executed git status after these steps, I see the untracked directories/files. But when I do git add -A and then executed git commit it shows me the following message

On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

After this, I deleted all the directories/files under proj1 directory and then executed git status. This time I could see deleted files in the untracked list. Also when I created a directory manually and then added a file inside it, I saw this file also in the untracked files output of git status command. I was also able to execute git add -A and commit the file successfully. It seems that mass copied files are not detected by git.

KurioZ7
  • 6,028
  • 13
  • 46
  • 65
  • Your `cp` command doesn't copy to `proj1`, but to `C:/myrepo/`. – Joachim Sauer Oct 09 '20 at 08:52
  • You must copy your project to your GiHub project `proj1` like this: `cp -a C:/Projects/source/. C:/myrepo/proj1`. The `proj1` folder should also contain a `.git` folder. – flaxel Oct 09 '20 at 08:54
  • Sorry for the mistake. I have updated the question. – KurioZ7 Oct 09 '20 at 08:55
  • Have the copied files arrived in the folder `proj1`? – flaxel Oct 09 '20 at 09:00
  • Does this answer your question? [Why doesn't git recognize that my file has been changed, therefore git add not working](https://stackoverflow.com/questions/16993082/why-doesnt-git-recognize-that-my-file-has-been-changed-therefore-git-add-not-w) – flaxel Oct 09 '20 at 09:05
  • @flaxel: the copied directories and files under proj1 directory. – KurioZ7 Oct 09 '20 at 09:18
  • I read the SO thread you pasted. I executed the command git rm --cached *.* -r . Now when I execute git status command I see all the untracked files, but when I do git add -A and then if i do git commit, i see the message "nothing to commit, working tree clean" – KurioZ7 Oct 09 '20 at 09:29
  • After the `git commit` command you must upload the results with `git push`. – flaxel Oct 09 '20 at 14:28

0 Answers0