My question is simple : Why is the parent directory
changing it's commit message with the latest commit message I did on any sub-directory
or any file
inside that parent directory?
Is it possible for the parent folder to have the exact same commit message that I made once, forever?
What happening is - If I commit any file, then every ancestor (parent folder) also changes its commit message with that latest commit I just made.
This is parent
folder. (see its commit message)
This is the folder inside that parent folder (inside client)
This is the folder inside src
folder
And this is the file inside hooks
which I committed and added the message to.
So the Path goes like this: client
> src
> hooks
> request.js
and I commit request.js
. I see that every ancestor folder of it, changed its commit message to this commit message. I don't want that. I want that commit message to be applied only on request.js
, not any other folder or file.
How can I stop this behavior? Or am I doing something wrong (commiting in wrong way)?
CodePudding user response:
Why is the parent directory changing it's commit message ... ?
Folders and files don't have a commit message. I think the UI you're using is probably showing you the most recent commit in the history of each folder.
Suppose you make another commit after "added response to GET the planets" which changes the file:
client/src/code/coolapp.js # e.g. commit message: "Add cool feature to coolapp"
Now your directory history might look like:
client/: "Add cool feature to coolapp"
client/src: "Add cool feature to coolapp"
client/src/code: "Add cool feature to coolapp"
client/src/hooks: "added response to GET the planets"
It's simply the most recent commit that you would see if you were to perform git log -- <path>
.