
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.
Read More
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 …
Read More
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 …
Read More
1~$ git fetch 2fatal: unable to access 'https://github.com/icasimpan/example.git/': SSL connect error Fixed by: 1yum update -y nss curl libcurl
Read More
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
Read More
In some situations, you only need the latest commit log, saving space in the process. You have to do it as follows: 1git clone --depth=1 REPO
Read More
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 "ismael.angelo@casimpan.com"
Read More
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. 1git …
Read More
1me@mysite:/var/www/sites/mysite.local$ git tag --delete origin :v1.56 2To git@git-server:mysite.git 3Deleted tag 'v1.56' (was f346d287f)
Read More