Why does Github show the username twice? - github

I pushed / updated a document in github. It shows my username twice (red blocks).

Each commit has both a committer and an author. The author made the original change, the committer is the one who made the commit. These are usually the same, but can be different if the commit was rebased. The original author is also often added as a courtesy when committing someone else's work via a patch file, or an integration tool merging someone else's branch.
You can see this with git log --pretty=fuller. Here's an example of a merge done on my behalf by Github.
commit d3adb33fd3adb33fd3adb33fd3adb33f (HEAD -> origin/master, master)
Merge: 123abcd abcd123
Author: Michael G. Schwern <schwern#pobox.com>
AuthorDate: Fri Feb 28 17:02:22 2020 -0800
Commit: GitHub <noreply#github.com>
CommitDate: Fri Feb 28 17:02:22 2020 -0800
Merge pull request #1234 from project/issue/#1233
Fix: Mistakes were made.
In your case you may have made the commit using Git configured with the same name but a different email address; Github will consider these to be different people. This can happen if you work on the same project on different machines and do a rebase.
If that is the case, you can merge those other email addresses into your Github account in your Github Email Settings.

Can you check if you already have a global git account configured on your device? I guess you have two different git accounts and you're using the one that isn't configured as your global username, to push the code.

Related

How to restore commit history before first release on Github

I have a repository where I made many commits in January. Fast forward to July, when I was tinkering with Git, I got to know about the Releases feature.
Since I had many major features to push, I decided to create a new release.
Now I need the January commits for showing to someone but there is no trace of them anywhere, neither in the Commits section nor in releases. It just shows 4 commits since this release
The commit history shows as if I started commiting to the repo from July only
Any help is appreciated.
Somehow, my entire history was stored not in branch but in a tag that I created when creating that release.
That's why even going too much deeper didn't reveal anythin since the commits were HEADless.
I noted the tag's hash and did
git checkout tag-hash // now no branch checked out
git checkout -b new-branch-name tag-hash // created new branch from that tag
And with this, my new branch has the whole commit history

GitHub says authored and committed different people but it's the same person and same account

I am confused, GitHub shows me as two different people. I use the same account when pushing from my local repos and then checking it on GitHub.
I only have one account on GitHub. So it's a surprise to me I'd be shown as two different people.
It happens when you don't have the same email address on your local git configuration and on your GitHub account.
You can set your email address in git with this command:
git config --global user.email "email#example.com"
And on GitHub at this address: https://github.com/settings/emails
For more information, see GitHub's help:
Why are my commits linked to the wrong user?
Why is my commit associated with the wrong person?
Note that the changes will take effect for next commits, the commit history won't be changed, if you want to change the author or committer on already existing commits, you'll have to amend them.
Also had the same issue. This strange behaviour apparently only happens to me when the locally configured git email has caps:
Commits:
$ git log --pretty=full
commit b1149b046e31a82de34d550dda53637908d1956b (HEAD -> feature1,
origin/feature1)
Author: Sam <emailwithCaps#gmail.com>
Commit: Sam <emailwithCaps#gmail.com>
caps email
commit 0e1dcabfa7d3dc7f1333d2c15967ca6288515e42
Author: Sam <nonexistingemail#gmail.com>
Commit: Sam <nonexistingemail#gmail.com>
aasss2wq
As you can see, Author and Commiter have the same name and email on the commits.
On GitHub:
Commit Email with caps vs no caps on GitHub
Not sure why it happens.
Concluing: Making all characters lower case in the local git config user.email seemed to solve this for me.

Commit history of projects prior to its date of creation on GitHub

What does it mean when base repositories of projects hosted on GitHub have commit history prior to project creation date on GitHub? Also, what does it mean when forks of a project have commit history prior to its creation date on GitHub?
It simply means that the user that created that repository managed the repo before, outside of GitHub.
Imagine this as a document in Dropbox, you create it today in your computer, you upload it next week to Dropbox:
Date of creation: 27th Jan 2015
Data of file creation on Dropbox: 4th Feb 2015
This might seem tricky to you because you, if youare not distinguishing git and github. You can have a whole network of git repositories without GitHub.
GitHub provides visualization and great tooling on top of git repos.

How to pull from local branch in Xcode

So I have a commit to my local branch that has yet to be pushed to my remote. I worked a little after my local commit and decided to go back to what I had committed. I selected the Discard All Changes . . . under Source Control but it seemed to go back farther then I wanted. I can see the commits under my History . . . but when I select Pull . . . all I get is options for my remote branch (which still shows a branch that I terminated, so helping me refresh that would be great too but the other thing is more important right now).
Any and all suggestions are greatly appreciated.
Solution: So what I ended up doing was using git log to find the commit that I wanted. I copied the commit number. Then git reset --hard *commit #*. The files were in my Finder window but no in my Xcode project, so I went to Files->Add Files to "projectName" and added the files. After I assured myself that everything was fixed I committed my build using git push --force.
Hope that is helpful to someone, feel free to comment if you have any questions on my solution.
CGTheLedgend,
So when you git pull you are actually pulling source code from your remote repository into your local one. Instead what you want to do is a git log which will show all your commits in the following format:
commit f5c5cac0033439c17ebf905d4391dc0705dbd5f1
Author: CGTheLegened
Date: Fri Sep 6 14:36:59 2010 -0500
Added and modified the files.
commit c14809fafb08b9e96ff2879999ba8c807d10fb07
Author: CGTheLegened
Date: Tue Sep 4 08:59:32 2010 -0500
Just simple test for core.editor.
... etc ...
From here, you want to use the git reset command to go to a specific commit. If you do:
git reset --hard c14809fa
To make your local code and local history be just like it was at that commit.
Please let me know if you have any questions!

how to make pull requests *without* a github account?

One of the goals of git is to be decentralized. If Github is to be the ... hub of git, then maybe it could take into account that there are other hubs out there, and allow pull requests to happen on git URLs that are not hosted on github.
The documentation is fairly clear about this: pull requests require that you have a Github account and that you fork a repository on github. Is this a real current technical limitation or is there a way to workaround that on Github?
If not, is it eventually planned to allow Github's "pull requests" tool to actually allow to pull from repositories outside of the Github silo?
You can use git request-pull to achieve the same kind of workflow (which is improved with Git1.7.9+).
See the article "using signed tag in pull-requests"
A typical distributed workflow using Git is for a contributor to fork a project, build on it, publish the result to her public repository, and ask the "upstream" person (often the owner of the project where she forked from) to pull from her public repository. Requesting such a "pull" is made easy by the git request-pull command.
Starting from Git release v1.7.9, a contributor can add a signed tag to the commit at the tip of the history and ask the integrator to pull that signed tag.
When the integrator runs git pull:
the signed tag is automatically verified to assure that the history is not tampered with.
In addition, the resulting merge commit records the content of the signed tag, so that other people can verify that the branch merged by the integrator was signed by the contributor, without fetching the signed tag used to validate the pull request separately and keeping it in the refs namespace.
With Git 2.40 (Q1 2023), "git request-pull"(man) can strip embedded signature from signed tags using non-PGP signatures.
See commit a9cad02 (25 Jan 2023) by Gwyneth Morgan (gwymor).
(Merged by Junio C Hamano -- gitster -- in commit ad7fd3c, 08 Feb 2023)
request-pull: filter out SSH/X.509 tag signatures
Signed-off-by: Gwyneth Morgan
git request-pull(man) filters PGP signatures out of the tag message, but not SSH or X.509 signatures.