Let's say we have two sessions -sessionOne and sessionTwo. I used sessionOne two create an initial project that has two commits and push this project to github remote:
Then I (as another user) use sessionTwo to clone this Github repository to local and then I modify a file and create a commit locally:
Then I switch to seesionOne and create a third commit then push change to remote:
Now I switch to sessionTwo and pull from the remote, since I (on behalf of another user ) made changes on existing on seesionTwo before, there is confilct and so I fix the conflict and git adds a merge change, then I push changes to remote as:
Now my question is, when I use sessionOne to do git pull
, I gets a same output which is very similar to above:
the "modify sth" commit is originally from sessionTwo, but in sessionOne's Sourcetree output, it is colored in blue, after long time, I might think this is the change I made after a long time when I quickly look at the graph.
CodePudding user response:
Commits don't "belong" to any particular repo, whether that repo is the origin, upstream, some other remote or a local clone. Git does not explicitly track which repo introduced the commit. The things git tracks for each commit are:
- the commit hash
- the state of all the files in the repo as of that commit.
- it's parent commit(s)
- the commit author
- the committer
- the author date
- the commit date
- the commit message
There might be some other things I missed, but there is nothing about which repo the commit came from.