summaryrefslogtreecommitdiff
path: root/src/content/tils/2020/08/14/browse-git.adoc
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-04-16 11:20:43 -0300
committerEuAndreh <eu@euandre.org>2025-04-16 11:20:43 -0300
commitd36c2e459a74ec67e523539eb98b78b95b01432a (patch)
treea7099fbfbdab6a21f59b6efe095bffb40ceae646 /src/content/tils/2020/08/14/browse-git.adoc
parentsrc/content/style.css: Show header on hover only (diff)
downloadeuandre.org-d36c2e459a74ec67e523539eb98b78b95b01432a.tar.gz
euandre.org-d36c2e459a74ec67e523539eb98b78b95b01432a.tar.xz
src/content/: Normalize [source,$lang] code blocks
Diffstat (limited to 'src/content/tils/2020/08/14/browse-git.adoc')
-rw-r--r--src/content/tils/2020/08/14/browse-git.adoc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/content/tils/2020/08/14/browse-git.adoc b/src/content/tils/2020/08/14/browse-git.adoc
index 3d7660e..6b3ff6d 100644
--- a/src/content/tils/2020/08/14/browse-git.adoc
+++ b/src/content/tils/2020/08/14/browse-git.adoc
@@ -4,7 +4,7 @@
I commonly use tools like `git log` together with `git show` when inspecting
past changes in a repository:
-[source,shell]
+[source,sh]
----
git log
# search for a the commit I'm looking for
@@ -18,7 +18,7 @@ but to browse the whole repository at that specific commit.
I used to accomplish it the "brute force" way: clone the whole repository in
another folder and checkout the commit there:
-[source,shell]
+[source,sh]
----
git clone <original-repo> /tmp/tmp-repo-clone
cd /tmp-repo-clone
@@ -28,7 +28,7 @@ git checkout <my-commit>
But git itself allows we to specific the directory of the checkout by using the
`--work-tree` global git flag. This is what `man git` says about it:
-[source,txt]
+[source,text]
----
--work-tree=<path>
Set the path to the working tree. It can be an absolute path or a path relative to the current working
@@ -40,7 +40,7 @@ But git itself allows we to specific the directory of the checkout by using the
So it allows us to set the desired path of the working tree. So if we want to
copy the contents of the current working tree into `copy/`:
-[source,shell]
+[source,sh]
----
mkdir copy
git --work-tree=copy/ checkout .
@@ -49,7 +49,7 @@ git --work-tree=copy/ checkout .
After that `copy/` will contain a replica of the code in HEAD. But to checkout
a specific, we need some extra parameters:
-[source,shell]
+[source,sh]
----
git --work-tree=<dir> checkout <my-commit> -- .
----
@@ -59,7 +59,7 @@ Morse signals to git, but we're actually saying to `git-checkout` which sub
directory of `<my-commit>` we want to look at. Which means we can do something
like:
-[source,shell]
+[source,sh]
----
git --work-tree=<dir> checkout <my-commit> -- src/
----