Say, I have my git repo (the .git folder) located in ~/my_project/. Assume also that my project’s folder is assembled like that:
my_project
|
|____src
|
|__com
|
|__org
Last of all, assume that I’d like to stage the com folder for commit. I may do it in at least two ways:
albus@hogwarts:~/my_project$ git add src/comalbus@hogwarts:~/my_project/src$ git add com
Would there be any difference between the two invocations? What about git format-patch or git am? Do they depend on the current path?
People may laught at my question, but truth is, a colleague of mine said that they had trouble applying some patches, i.e. they had to apply them from different directories in the project path. They also recommended that I should do all git commands from the upmost project folder (i.e. my_project in this example). I never though there might be truth in this, but I’m not an expert where git comes into the picture and therefore I’m asking it here.
Thanks!
git format-patchcreates the same patch wherever you ran the command. Only thing that changes is where the patch file is generated.But different commands behave differently, which also depends on flags applied to them.
For example,
git diffhas the--relativeflag: