GitHub

How to Configure Expiry Objects (Git)

May 10th 2021, 9:41
By default, Git will perform garbage collection on unreferenced objects and clean reflog for entries that are more than 90 days old. For an object to be referenced, something must point to it; a tree, a commit, a tag, a branch, or some of the internal Git bookkeeping, such as...
625

How to Configure Rebase and merge (Git)

May 11th 2021, 2:54
By default, when performing git pull, a merge commit will be created if the history of the local branch has diverged from the remote one. However, to avoid all these merge commits, a repository can be configured so that it will default to rebase instead of merging when doing git...
1856

How to create a git directory template

May 10th 2021, 1:23
Sometimes, having a global configuration isn't enough. You will also need to trigger the execution of scripts (also known as Git hooks), exclude files, and so on. It is possible to achieve this with the template option set to git init. It can be given as a command-line option to...
1262

How to Create a template commit message (Git)

May 10th 2021, 10:50
we will see how to create a template commit message that will be displayed in the editor when creating a commit. The template is only for the local user and not distributed with the repository in general. Step 1 : we will use the example repository from this post git...
2540

How to Query the existing configuration (Git)

May 11th 2021, 5:00
we will look at how we can query the existing configuration and set the configuration values. Step 1 : We'll use jgit again by using the following command: git clone https://git.eclipse.org/r/jgit/jgit cd jgit Step 2 : To view all the effective configurations for the current Git repository, run the following...
589

How to Configure targets (Git)

May 10th 2021, 6:53
In this post, we will look at the different layers that can be configured. The layers are as follows: SYSTEM: This layer is system-wide and can be found in /etc/gitconfig GLOBAL: This layer is global for the user and can be found in ~/.gitconfig LOCAL: This layer is local to...
586

How to search through the history code (Git)

May 11th 2021, 5:11
Sometimes, You may want to know which commits touched a specific method or variable. This is also possible using git log. You can perform a search for a string, for example, or a variable or method, and git log will give you the commits, adding or deleting the string from...
523

How to Find commits in the history (Git)

May 11th 2021, 2:42
we will use the JGit repository, trying to find commits related to the "Performance" keyword. In this recipe, we will look through the entire history, so we don't need the master branch to point to a specific commit. Step 1 : we can use the --grep option to find specific...
748

How to View the history with gitk (Git)

May 10th 2021, 12:21
We saw earlier how we can view the history (the DAG) and visualize it by using git log. However, as the history grows, the terminal representation of the history can be a bit cumbersome to navigate. Fortunately, there are a lot of graphical tools in Git, one of them being...
605

How to Get a list of the changed files in Git

May 10th 2021, 10:09
The same repository and HEAD position (HEAD pointing to 93da791) that we saw in the previous post will be used. The release is also the same, which is v5.8.1.202007141445-r. Step 1 : The following command lists all the files that have changed since the last release (v5.8.1.202007141445-r) git diff --name-only...
1226