GitHub Tricks

Posted by Daksh on Wednesday, May 11, 2022

Useful Tricks for GitHub

  1. Visit any commit page on GitHub, and add .patch to the end of the URL. You’ll get a patch file that shows the author name, mail, date, and the diff.
  2. In any GitHub repository, replace github.com with github1s.com in the URL. You’ll get a VS Code-like editor for that repository.
  3. Tokenized access to GitHub account. Go to Settings > Developer settings > Personal access tokens > choose classic token option > Generate new token (with appropriate name and expiry date)> select required scopes (repo, admin, user are the most common ones) > Generate token > copy the token > save it for future use. Next, inside remote server, use gh auth login, select GitHub.com, Https, paste the token, and you’re done. Now you can use gh commands to interact with GitHub. Use the GitHub CLI to automate your GitHub workflow from the command line. The GitHub CLI option is available alongwith the SSH, HTTPS, and GitHub CLI options in the remote server.
  4. Visiting the first commit of a repository. Either clone the repo and use git log --reverse to get the commit hash, or click on the “Older” button on the commit page for once, you will get the url with “+34” at the end. Suppose, the current number of commits is N, then the first commit will be at N-34-1. Replace the “34” with “N-34-1” and you will get the first commit page.