How to rebase commits to another branch (Git)

August 15th 2021, 9:20
we are going to perform a very simple rebase, where we will introduce a new file, commit that file, make a change to it, and then commit it again so that we end up with two new commits. Step 1 : The jgit repository can be cloned as follows git...

How to Create an orphan branch (Git)

August 15th 2021, 1:36
You are now familiar with Git's data model, the DAG. You have seen that objects have a parent. When you create a new branch, the commit is its parent. However, in some situations, it is useful to have a branch with no parent. Step 1 : It is actually easy...

How to check the difference between branches (Git)

August 15th 2021, 11:35
A regular git diff between two branches will show you all the information, but it can be rather exhausting to sit and look at; maybe you are only interested in one file. Thus, you don't need the long unified diff. Perform the following steps to see the difference between the...

How to use git reuse recorded resolution (rerere) to merge Git conflicts

August 15th 2021, 12:17
When you work on long-living feature branches, you end up in a situation where you have the same conflicts occurring repeatedly. Here, you can use git rerere, which stands for reuse recorded resolution. Git rerere is not enabled by default, but can be enabled with the following command: git config...

How to force a merge commit (Git)

August 14th 2021, 10:50
Git supports almost any workflow. We have often encountered a situation that requires a merge commit while merging a feature, even though it can be done with a fast-forward merge. Those who requested it often use it to indicate that you have actually merged in a feature and want to...

How to work with Git and remotes (Git)

August 15th 2021, 12:07
At some point, it is very likely that you have cloned somebody's repository. This means that you have an associated remote. The remote is usually called origin because it is where the source originated from. While working with Git and remotes, you will get some benefits from Git. Follow these...

How to Manage local branches (Git)

August 14th 2021, 11:55
Let's start by creating a few local branches. Step 1 : Use the following command to clone the jgit repository to match: sudo apt install git cd jgit Step 2 : Whenever you start working on a bug fix or a new feature in your project, you should create a...

How to Configure The refspec

August 15th 2021, 1:09
In this post, we'll be using the jgit repository as our server repository, but we have to make a clone of it to a bare repository so we can push it. You can't push to the checked-out branch on a non-bare repository, as this can overwrite the work area and...

How to use Git aliases

August 15th 2021, 3:42
An alias is a nice way to configure long and/or complicated Git commands to represent short useful ones. An alias is simply a configuration entry under the alias section. It is usually configured to --global to apply it everywhere. Step 1 : In this post, we will use the jgit...

How to Configure Autocorrect (Git)

August 15th 2021, 3:44
This configuration is useful when you get tired of messages such as the following one just because you made a typo on the keyboard: git statis By setting the configuration to help.autocorrect, you can control how Git will behave when you accidentally send a typo to it. By default, the...