Commit Phabricator Revision to GitHub

Summarized workflow from LLVM documentation. Just keep this as a checklist for future commits. In this passage, I will use D102669 as an example to show the entire commit procedure. Since the commit is done on the patch branch. Let’s start by checking out the branch.

1. Check out the patch branch.

> git checkout D102669

2. Update commit message. Go to the Phabricator page of D102669. Copy the revision title as the header of the commit message. Then, on the option-menu to the right, select Edit Revision. Copy the revision summary as the body of the commit message. Remember to add a blank line after the header. Finally, add the revision link as the last line.

Go to the Phabricator page of D102669. On the option menu to the right, select Edit Revision.

3. Rebase the patch onto the latest commit on GitHub and then rerun the test cases locally.

> git pull --rebase origin main
> ninja check-clang-analysis

4. Re-check the list of commits to be pushed.

> git log origin/main...HEAD

5. Push the commit.

git push origin HEAD:main

As a first-time committer, the push operation was rejected twice before it was finally committed. First, GitHub requires the git push operation cannot be authenticated via username and password. Therefore, I replaced the remote link with the SSH link to solve the problem.

Username for 'https://github.com': Snape3058 
Password for 'https://[email protected]': 
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. 
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information. 
fatal: Authentication failed for 'https://github.com/llvm/llvm-project.git/'

Second, when you set your Emails private, GitHub will reject the pushing requirement if the operation will leak your Email address. Therefore, you need to uncheck the option to allow this operation.

remote: Resolving deltas: 100% (21/21), completed with 21 local objects.                                                                                                                                             
remote: error: GH007: Your push would publish a private email address.                                                                                                                                               
remote: You can make your email public or disable this protection by visiting:                                                                                                                                       
remote: http://github.com/settings/emails                                                                                                                                                                            
To github.com:llvm/llvm-project.git                                                                                                                                                                                  
 ! [remote rejected]           HEAD -> main (push declined due to email privacy restrictions)                                                                                                                        
error: failed to push some refs to '[email protected]:llvm/llvm-project.git'

That’s all for my first commit to GitHub for the LLVM project. Hope it would be helpful to my future commits and other contributors.

References:

1. https://llvm.org/docs/DeveloperPolicy.html#commit-messages
2. https://www.llvm.org/docs/Phabricator.html#committing-a-change
3. https://www.llvm.org/docs/GettingStarted.html#commit-from-git