<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>version-control on IT Quicktasks</title><link>https://quicktasks.ismael.casimpan.com/series/version-control/</link><description>Recent content in version-control on IT Quicktasks</description><generator>Hugo -- gohugo.io</generator><copyright>Copyright © 2018–2022, Ismael Casimpan Jr.; All Rights Reserved</copyright><lastBuildDate>Sun, 27 Mar 2022 23:17:11 +0800</lastBuildDate><atom:link href="https://quicktasks.ismael.casimpan.com/series/version-control/index.xml" rel="self" type="application/rss+xml"/><item><title>Git Latest Hash</title><link>https://quicktasks.ismael.casimpan.com/post/git-latest-hash/</link><pubDate>Sun, 27 Mar 2022 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/git-latest-hash/</guid><description>
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.</description></item><item><title>Remove Large Files Committed in Git</title><link>https://quicktasks.ismael.casimpan.com/post/remove-large-files-committed-in-git/</link><pubDate>Sun, 21 Mar 2021 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/remove-large-files-committed-in-git/</guid><description>
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&amp;gt; &amp;#39;git rm --cached --ignore-unmatch path/to/huge-file.mp4&amp;#39; \ 3&amp;gt; --prune-empty --tag-name-filter cat -- --all You should be seeing something like below:
1~$ git filter-branch --force --index-filter \ 2&amp;gt; &amp;#39;git rm --cached --ignore-unmatch content/sync/files/public/2020-04/Bad_Luck.mp4&amp;#39; \ 3&amp;gt; --prune-empty --tag-name-filter cat -- --all 4Rewrite 8dfc744d18880f14dbc8fcd09f50c4bc3ede71 (1049/1091)rm &amp;#39;content/sync/files/public/2020-04/Bad_Luck.</description></item><item><title>Pull Request via Github API</title><link>https://quicktasks.ismael.casimpan.com/post/pull-request-via-github-api/</link><pubDate>Tue, 08 Sep 2020 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/pull-request-via-github-api/</guid><description>
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 &amp;#34;Accept: application/vnd.github.v3+json&amp;#34; \ 4https://api.github.com/repos/octocat/hello-world/pulls \ 5-d &amp;#39;{&amp;#34;title&amp;#34;:&amp;#34;title&amp;#34;,&amp;#34;head&amp;#34;:&amp;#34;head&amp;#34;,&amp;#34;base&amp;#34;:&amp;#34;base&amp;#34;}&amp;#39; The above means, create a pull request with title &amp;quot;title&amp;quot; with code in branch &amp;quot;head&amp;quot; against the branch in &amp;quot;base&amp;quot; for the repo https://github.com/octocat/hello-world.git
In case you need to authenticate, add
1-u &amp;lt;user&amp;gt;:&amp;lt;GITHUB_TOKEN&amp;gt; before the -H
1curl \ 2-X POST \ 3-u your_user:DEFINED_GITHUB_TOKEN_HERE 4-H &amp;#34;Accept: application/vnd.github.v3+json&amp;#34; \ 5https://api.github.com/repos/octocat/hello-world/pulls \ 6-d &amp;#39;{&amp;#34;title&amp;#34;:&amp;#34;title&amp;#34;,&amp;#34;head&amp;#34;:&amp;#34;head&amp;#34;,&amp;#34;base&amp;#34;:&amp;#34;base&amp;#34;}&amp;#39; You can also use a payload json file for this value:</description></item><item><title>SSL Connect Error on Git Fetch</title><link>https://quicktasks.ismael.casimpan.com/post/ssl-connect-error-on-git-fetch/</link><pubDate>Fri, 12 Jun 2020 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/ssl-connect-error-on-git-fetch/</guid><description>
1~$ git fetch 2fatal: unable to access &amp;#39;https://github.com/icasimpan/example.git/&amp;#39;: SSL connect error Fixed by:
1yum update -y nss curl libcurl</description></item><item><title>Telling git To Use Specific Private Key</title><link>https://quicktasks.ismael.casimpan.com/post/telling-git-to-use-specific-private-key/</link><pubDate>Fri, 29 May 2020 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/telling-git-to-use-specific-private-key/</guid><description>
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</description></item><item><title>Git with Latest Commit Log Only</title><link>https://quicktasks.ismael.casimpan.com/post/git-with-latest-commit-log-only/</link><pubDate>Tue, 26 May 2020 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/git-with-latest-commit-log-only/</guid><description>
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</description></item><item><title>Quick Setup for You Git Code</title><link>https://quicktasks.ismael.casimpan.com/post/quickly-work-git-code/</link><pubDate>Mon, 08 Apr 2019 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/quickly-work-git-code/</guid><description>
If you need less keystrokes in updating your git code specially if it's very minimal change, do the following:
1git clone https://&amp;lt;github_token_here&amp;gt;@github.com/icasimpan/quicktasks-git 2cd quicktasks-git 3git config user.name &amp;#34;Ismael Casimpan&amp;#34; 4git config user.email &amp;#34;ismael.angelo@casimpan.com&amp;#34;</description></item><item><title>Git Cherry-Pick Merge</title><link>https://quicktasks.ismael.casimpan.com/post/git-cherrypick/</link><pubDate>Fri, 23 Nov 2018 06:03:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/git-cherrypick/</guid><description>
Cherry Picking in Git is quite easy: For single commit
1git checkout &amp;lt;destination_branch&amp;gt; 2git cherry-pick &amp;lt;hash-here&amp;gt; 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 checkout &amp;lt;destination_branch&amp;gt; 2git cherry-pick &amp;lt;initial_commit_hash&amp;gt;..&amp;lt;terminal_commit_hash&amp;gt; To include the 'initial_commit_hash' and 'terminal_commit_hash', use the following:
1git cherry-pick &amp;lt;initial_commit_hash&amp;gt;^..&amp;lt;terminal_commit_hash&amp;gt; Note that conflicts would pause cherry-picking and ask to resolve the conflict. You can then continue as follows:
1git cherry-pick --continue See details in https://medium.</description></item><item><title>Compare tags contents in github</title><link>https://quicktasks.ismael.casimpan.com/post/compare-tag-contents-github/</link><pubDate>Sun, 08 Apr 2018 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/compare-tag-contents-github/</guid><description>
Example https://github.com/icasimpan/shcf/compare/shcf-v0.2.0...shcf-v0.3.0</description></item><item><title>Deleting a local git tag</title><link>https://quicktasks.ismael.casimpan.com/post/deleting-local-git-tag/</link><pubDate>Sun, 08 Apr 2018 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/deleting-local-git-tag/</guid><description>
1me@mysite:/var/www/sites/mysite.local$ git tag --delete origin :v1.56 2To git@git-server:mysite.git 3Deleted tag &amp;#39;v1.56&amp;#39; (was f346d287f)</description></item><item><title>Deleting a remote git repo branch</title><link>https://quicktasks.ismael.casimpan.com/post/deleting-remote-git-repo/</link><pubDate>Sun, 08 Apr 2018 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/deleting-remote-git-repo/</guid><description>
1me@mysite:/var/www/sites/mysite.local$ git push origin :release-redesign 2To git@git-server:mysite.git 3- [deleted] release-redesign</description></item><item><title>Deleting a remote git tag</title><link>https://quicktasks.ismael.casimpan.com/post/deleting-remote-git-tag/</link><pubDate>Sun, 08 Apr 2018 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/deleting-remote-git-tag/</guid><description>
1me@mysite:/var/www/sites/mysite.local$ git push origin :v1.56 2To git@git-server:mysite.git 3- [deleted] v1.56</description></item><item><title>Duplicating a git repo</title><link>https://quicktasks.ismael.casimpan.com/post/duplicating-git-repo/</link><pubDate>Sun, 08 Apr 2018 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/duplicating-git-repo/</guid><description>
1git clone --bare https://example.com/repo.git 2cd repo.git 3git push --mirror https://remote-example.com/repo.git See https://help.github.com/articles/duplicating-a-repository/</description></item><item><title>git log (cli graph)</title><link>https://quicktasks.ismael.casimpan.com/post/git-log-ci-graph/</link><pubDate>Sun, 08 Apr 2018 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/git-log-ci-graph/</guid><description>
1git log --graph --oneline --decorate --all</description></item><item><title>Git Patch Creation/Apply</title><link>https://quicktasks.ismael.casimpan.com/post/git-patch-creation-apply/</link><pubDate>Sun, 08 Apr 2018 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/git-patch-creation-apply/</guid><description>
See https://www.devroom.io/2009/10/26/how-to-create-and-apply-a-patch-with-git/</description></item><item><title>Git submodules (similar to svn:externals)</title><link>https://quicktasks.ismael.casimpan.com/post/git-submodules/</link><pubDate>Sun, 08 Apr 2018 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/git-submodules/</guid><description>
See https://chrisjean.com/git-submodules-adding-using-removing-and-updating/</description></item><item><title>Move a directory in one git repo to another (preserving history)</title><link>https://quicktasks.ismael.casimpan.com/post/move-directory-in-git-to-another-repo/</link><pubDate>Sun, 08 Apr 2018 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/move-directory-in-git-to-another-repo/</guid><description>
See http://gbayer.com/development/moving-files-from-one-git-repository-to-another-preserving-history/</description></item><item><title>Negating contents of .gitignore</title><link>https://quicktasks.ismael.casimpan.com/post/negating-contents-of-gitignore/</link><pubDate>Sun, 08 Apr 2018 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/negating-contents-of-gitignore/</guid><description>
See https://stackoverflow.com/questions/5533050/gitignore-exclude-folder-but-include-specific-subfolder</description></item><item><title>Rename git branch</title><link>https://quicktasks.ismael.casimpan.com/post/rename-git-branch/</link><pubDate>Sun, 08 Apr 2018 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/rename-git-branch/</guid><description>
If on a branch you want renamed
1git branch -m new-name If on a different branch
1git branch -m old-name new-name</description></item></channel></rss>