Sometimes, for automation purposes, you would like to get the latest commit in a working copy.
Below is how you do it.
1~$ git rev-parse --short HEAD Remove the --short HEAD if you need the longer version.
It's quite annoying when you committed large files to git specially if it's something that's something confidential.
We'll relatively easy to do that. Just use the 'filter-branch' command in git as follows:
1git filter-branch --force --index-filter \ 2> 'git rm --cached --ignore-unmatch …
From the example in https://docs.github.com/en/rest/reference/pulls#create-a-pull-request, it seems quite easy:
1curl \ 2-X POST \ 3-H "Accept: application/vnd.github.v3+json" \ 4https://api.github.com/repos/octocat/hello-world/pulls \ 5-d …
Sometimes, you need to use specific keys. To do it, use ssh config, something like below in ~/.ssh/config
1host github.com 2HostName github.com 3IdentityFile ~/.ssh/id_rsa_github 4User git See details in https://superuser.com/questions/232373/how-to-tell-git-which-private-key-to-use
If you need less keystrokes in updating your git code specially if it's very minimal change, do the following:
1git clone https://<github_token_here>@github.com/icasimpan/quicktasks-git 2cd quicktasks-git 3git config user.name "Ismael Casimpan" 4git config user.email "firstname.lastname@example.org"
Cherry Picking in Git is quite easy: For single commit
1git checkout <destination_branch> 2git cherry-pick <hash-here> See https://swsblog.stanford.edu/blog/cherry-picking-small-git-lesson
Multiple commit NOTE: only the commits between 'initial_commit_hash' and 'terminal_commit_hash' are merged.