Re: git a/xyz or b/xyz
- From
Shaoxuan Yuan <shaoxuan.yuan02@gmail.com>
- Date
- Jun 18, 2022, 11:09 UTC
- Message-ID
- <CAJyCBORdr3kaBbBmec5T5JAjcUpq6mSKQC=8_poLaZzSpkMJLA@mail.gmail.com>
- In-Reply-To
- <b4f40821-8592-1a35-8b60-219fd7e29e9f@luigifab.fr>
On Sat, Jun 18, 2022 at 6:50 PM Fabrice Creuzot <code@luigifab.fr> wrote:
Show 23 quoted lines
> > Hello > > When we are reading a "git diff", all paths are prefixed with "a/" and > "b/". Example: > diff --git a/xyz > index 4aa4b5230..1c2b8b69e 100644 > --- a/xyz > +++ b/xyz > @@ -1,7 +1,7 @@ > > > With my terminal, I double click on the path to select the full path for > copy. > > Then, when I paste: "git log a/xyz", > git says: unknown revision or path not in the working tree > > Ok, I need to remove the "a/" or "b/". > But, is git can understand that "a/xyz" is "xyz" because "a/xyz" does > not exist? > > Thanks
Hi Fabrice,
You can think that "a/" stands for "before" or "old content", whereas "b/" stands for "after" or "new content". Paths are prefixed with these to indicate which is before and which is after.
For example, when you call "git diff", it is to "view the changes you made relative to the index (staging area for the next commit)". In this case, "before" is the index, namely "a/", whereas "after" is your current working tree, namely "b/".
-- Thanks & Regards, Shaoxuan