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.
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:
There might be some other things I missed, but there is nothing about which repo the commit came from.
🚩 Note: The commit message might include information about which remote repo or git client the commit was pushed from, e.g. the
Merge branch 'master' from...
message in your example above, but that was added by GitHub, not by git, and won't be there if the merge was done directly, not through GitHub's interface.
You wrote "I might think this is the change I made", which means you are concerned about who made the changes. In that case, the commit author as well as the committer are tracked, as I listed above.
The author and the committer are usually the same, but differ when, for example, you, the author, commit a change and make a pull request. When the pull request is accepted, you will remain the author, but the person who accepts the pull request will be tracked as the committer for the commit that results from the pull request.