Git

How to rebase commits to another branch (Git)

April 18th 2021, 4:57
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...
460

How to Create an orphan branch (Git)

April 18th 2021, 3:18
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...
1356

How to check the difference between branches (Git)

April 18th 2021, 5:00
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...
394

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

April 17th 2021, 8:20
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...
358

How to force a merge commit (Git)

April 17th 2021, 11:11
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...
1649

How to work with Git and remotes (Git)

April 18th 2021, 4:51
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...
702

How to Manage local branches (Git)

April 17th 2021, 7:37
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...
662

How to Configure The refspec

April 18th 2021, 5:25
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...
924

How to use Git aliases

April 17th 2021, 7:38
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...
657

How to Configure Autocorrect (Git)

April 17th 2021, 7:41
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...
779