<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>git on IT Quicktasks</title><link>https://quicktasks.ismael.casimpan.com/tags/git/</link><description>Recent content in git on IT Quicktasks</description><generator>Hugo -- gohugo.io</generator><copyright>Copyright © 2018–2022, Ismael Casimpan Jr.; All Rights Reserved</copyright><lastBuildDate>Fri, 01 Apr 2022 06:03:11 +0800</lastBuildDate><atom:link href="https://quicktasks.ismael.casimpan.com/tags/git/index.xml" rel="self" type="application/rss+xml"/><item><title>Git Rebase</title><link>https://quicktasks.ismael.casimpan.com/post/git-rebase/</link><pubDate>Fri, 01 Apr 2022 06:03:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/git-rebase/</guid><description>
Rebase is used in merging two or more commits into one. Per experience, you can only rebase to an older commit.
Say, in these commits
1~$ git log -2 --pretty=oneline 2a0dd6b55000399c5f8b5f0f55286e167725e51c2 (HEAD -&amp;gt; v0.2.x_wip, origin/v0.2.x_wip) docktie_cli getx: Tested working implementation for #17. 3fb8f1de0cf1af7b447dfc9275878c516384f3a0d docktie_cli getx: initial implementation wip for #17 Older one is fb8f1de0cf1af7b447dfc9275878c516384f3a0d
Run:
1~$ git rebase --interactive HEAD~2 You'll be in an interactive mode (in an editor)
1pick fb8f1de docktie_cli getx: Implementation for #17.</description></item><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>Cloning Repos with Submodules</title><link>https://quicktasks.ismael.casimpan.com/post/cloning-repo-with-submodules/</link><pubDate>Wed, 26 Feb 2020 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/cloning-repo-with-submodules/</guid><description>
Submodules is quite a pain to manage. To make it easy, just use this command:
1git clone --recursive &amp;lt;repo_full_path&amp;gt; Failure to use --recursive would mean using a lot of commands later.
See detailed git submodules commands in https://www.vogella.com/tutorials/GitSubmodules/article.html</description></item><item><title>Checking Modified Files in a Commit</title><link>https://quicktasks.ismael.casimpan.com/post/check-modified-files/</link><pubDate>Wed, 19 Feb 2020 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/check-modified-files/</guid><description>
Get the commit-hash (e.g. of last commit)
1git log -1 Show the files changed only in commit
1git show --stat &amp;lt;commit-hash&amp;gt; See details in https://stackoverflow.com/questions/424071/how-to-list-all-the-files-in-a-commit</description></item><item><title>Merge Remote Branch to Local</title><link>https://quicktasks.ismael.casimpan.com/post/merge-remote-branch-to-local/</link><pubDate>Mon, 08 Apr 2019 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/merge-remote-branch-to-local/</guid><description>
If you need to merge a remote repo's (e.g. acquia) branch to your local branch:
1git pull acquia master</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>Checking Remote Tags</title><link>https://quicktasks.ismael.casimpan.com/post/checking-remote-tags/</link><pubDate>Sun, 08 Apr 2018 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/checking-remote-tags/</guid><description>
1git ls-remote --tags</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>Configure email and username</title><link>https://quicktasks.ismael.casimpan.com/post/configure-email-username/</link><pubDate>Sun, 08 Apr 2018 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/configure-email-username/</guid><description>
1git config user.name &amp;#34;Your Name Here&amp;#34; 2git config user.email &amp;#34;name@email.com&amp;#34;</description></item><item><title>Credentials to Pantheon.io git</title><link>https://quicktasks.ismael.casimpan.com/post/credentials-pantheon-git/</link><pubDate>Sun, 08 Apr 2018 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/credentials-pantheon-git/</guid><description>
Add the email to the Project's Team. The login credentials is the access to git as well. NOTE: If using Google login, make sure to change password.</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>Fix the identity used for a commit</title><link>https://quicktasks.ismael.casimpan.com/post/fix-identity-used-in-commit/</link><pubDate>Sun, 08 Apr 2018 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/fix-identity-used-in-commit/</guid><description>
1git commit --amend --reset-author</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>Ignore Permission Changes</title><link>https://quicktasks.ismael.casimpan.com/post/ignore-permission-changes/</link><pubDate>Sun, 08 Apr 2018 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/ignore-permission-changes/</guid><description>
1git config core.fileMode false details in https://stackoverflow.com/questions/1580596/how-do-i-make-git-ignore-file-mode-chmod-changes</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>Pathspec error on tag checkout</title><link>https://quicktasks.ismael.casimpan.com/post/pathspec-error-pn-tag-checkout/</link><pubDate>Sun, 08 Apr 2018 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/pathspec-error-pn-tag-checkout/</guid><description>
When you see error such as this
1bash-4.1$ git checkout Brick_Release_2018-06-19 2error: pathspec &amp;#39;Brick_Release_2018-06-19&amp;#39; did not match any file(s) known to git. 'git fetch' first and retry to checkout. If it still fails, ensure you're using the correct branch name.</description></item><item><title>Pull but no push in git</title><link>https://quicktasks.ismael.casimpan.com/post/pull-but-no-push/</link><pubDate>Sun, 08 Apr 2018 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/pull-but-no-push/</guid><description>
1$ git remote set-url --push origin no-pushing 2$ git push 3fatal: &amp;#39;no-pushing&amp;#39; does not appear to be a git repository 4fatal: The remote end hung up unexpectedly See https://stackoverflow.com/questions/7556155/git-set-up-a-fetch-only-remote</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><item><title>Reverting a commit</title><link>https://quicktasks.ismael.casimpan.com/post/reverting-a-commit/</link><pubDate>Sun, 08 Apr 2018 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/reverting-a-commit/</guid><description>
Scenario: A PR has been merged and further tests found out that it breaks the build. What do you do?
1git checkout -b to-revert-commits 2git revert &amp;lt;sha-to-remove&amp;gt; 3git push -u origin to-revert-commits 45## create a Pull Request and have it reviewed and merged by others.</description></item><item><title>Undo almost anything in git</title><link>https://quicktasks.ismael.casimpan.com/post/undo-almost-anything-in-git/</link><pubDate>Sun, 08 Apr 2018 23:17:11 +0800</pubDate><guid>https://quicktasks.ismael.casimpan.com/post/undo-almost-anything-in-git/</guid><description>
See https://github.com/blog/2019-how-to-undo-almost-anything-with-git</description></item></channel></rss>