Command Reference

GitHub CLI (gh)

Read Operations

View Token

gh auth token

View Auth Status

gh auth status

Search Repo by Owner

gh search repos --owner <USERNAME>

Search Repo without any flags

gh repo list

List secrets

gh secret list

List all open PRs

gh pr list

Copy PR from Web to local

gh pr checkout <NUMBER>

View difference in PR

gh pr diff

Write Operations

Authentication with PAT

gh auth login -p https --with-token < token

Create secret

gh secret set <SECRET-NAME>

Create pull request from local

gh pr create --base <DEFAULT-BRANCH> --head <NEW-BRANCH-NAME> --title '<PR-TITLE>' --body '<PR-COMMENT>'

Merge PR from local

gh pr merge

Git CLI (git)

Read Operations

TBC

Write Operations

Create a new branch

git checkout -b <NEW-BRANCH-NAME>
git push --set-upstream origin <NEW-BRANCH-NAME>

Switch branch

git switch <BRANCH-NAME>

Add files to GIT

git add .

Commit

git commit -m '<MESSAGE>'

Push to GitHub web

git push

Push changes from another branch

git push -u https://github.com/<USERNAME>/<REPOSITORY> <[NEW]BRANCH-NAME>

Pull Origin Branch (In Cases of Difference)

git fetch origin

Rebase Branch

git rebase

Clone Repo

git clone <https://GIT_URL/REPO/>

Last updated

Was this helpful?