Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'git add .' is not working after merge command of two branches

Tags:

git

I merged two branches. Now when I try to git add ., a folder simply is ignored by the command. So then I run 'git status' this is displayed in red - 'modified: admin'.

$ git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working d
#   (commit or discard the untracked or modified content in submodul
#
#       modified:   admin (modified content)
#
no changes added to commit (use "git add" and/or "git commit -a")

How do I commit the changes to admin?

like image 203
DevWL Avatar asked Dec 02 '25 12:12

DevWL


1 Answers

admin is not a file

This message:

#       modified:   admin (modified content)

indicates that admin is a submodule.

It's a submodule in a dirty state - there are uncommitted changes within it. From the main repository there are no changes to commit, as the submodule's repository hasn't been changed, hence nothing happens if you try to commit with this scenario you do however recieve a warning that the submodule contains "modified content".

How to commit the changes

The submodule needs to be updated for the main repository to be able to reference those changes i.e.:

cd admin
git commit -va
# review and then commit the changes
git push # important if you want to be able to access this change elsewhere

cd ..
git add admin
git commit admin -m "bumping admin submodule"

If the submodule is not your own code it's very likely this is not what you want to do - in which case please explain (by editing the question) the objective i.e. the purpose of making changes in a dependency.

like image 118
AD7six Avatar answered Dec 05 '25 03:12

AD7six



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!