summaryrefslogtreecommitdiff
path: root/src/content/tils/2020/08/14
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-04-18 02:17:12 -0300
committerEuAndreh <eu@euandre.org>2025-04-18 02:48:42 -0300
commit020c1e77489b772f854bb3288b9c8d2818a6bf9d (patch)
tree142aec725a52162a446ea7d947cb4347c9d573c9 /src/content/tils/2020/08/14
parentMakefile: Remove security.txt.gz (diff)
downloadeuandre.org-020c1e77489b772f854bb3288b9c8d2818a6bf9d.tar.gz
euandre.org-020c1e77489b772f854bb3288b9c8d2818a6bf9d.tar.xz
git mv src/content/* src/content/en/
Diffstat (limited to 'src/content/tils/2020/08/14')
-rw-r--r--src/content/tils/2020/08/14/browse-git.adoc76
1 files changed, 0 insertions, 76 deletions
diff --git a/src/content/tils/2020/08/14/browse-git.adoc b/src/content/tils/2020/08/14/browse-git.adoc
deleted file mode 100644
index 6b3ff6d..0000000
--- a/src/content/tils/2020/08/14/browse-git.adoc
+++ /dev/null
@@ -1,76 +0,0 @@
-= Browse a git repository at a specific commit
-:categories: git
-
-I commonly use tools like `git log` together with `git show` when inspecting
-past changes in a repository:
-
-[source,sh]
-----
-git log
-# search for a the commit I'm looking for
-git show <my-commit>
-# see the diff for the commit
-----
-
-But I also wanted to not only be able to look at the diff of a specific commit,
-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,sh]
-----
-git clone <original-repo> /tmp/tmp-repo-clone
-cd /tmp-repo-clone
-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,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
- directory. This can also be controlled by setting the GIT_WORK_TREE environment variable and the
- core.worktree configuration variable (see core.worktree in git-config(1) for a more detailed
- discussion).
-----
-
-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,sh]
-----
-mkdir copy
-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,sh]
-----
-git --work-tree=<dir> checkout <my-commit> -- .
-----
-
-There's an extra `-- .` at the end, which initially looks like we're sending
-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,sh]
-----
-git --work-tree=<dir> checkout <my-commit> -- src/
-----
-
-And with that `<dir>` will only contain what was inside `src/` at `<commit>`.
-
-After any of those checkouts, you have to `git reset .` to reset your current
-staging area back to what it was before the checkout.
-
-== References
-
-:so-link: https://stackoverflow.com/a/16493707
-
-. {so-link}[GIT: Checkout to a specific folder] (StackOverflow)