Posts

How to Add a Git note (Git)

Reginald LynchApril 18th 2021, 5:16
We will add some extra information to the already released code. If we were doing it in the actual commits, we would see the commit hashes change. Step 1 : Before we start, we need a repository to work in; you can use the previous clone of jgit, you can...
573

How to Add rebase with autosquash (Git)

Reginald LynchApril 17th 2021, 7:44
We will create a branch from origin/master so we are ready to add commits to our fix. Let's start with something like this: git checkout -b readme_update_developer --track origin/master Step 1 : Start by echoing some text into README.md: echo "More information for developers" >> README.md Step 2 : This...
408

How to Change the author of commits using a rebase (Git)

Reginald LynchApril 18th 2021, 5:27
When starting to work on a new project, it is common to forget to set the author name and author email address for the specified project. Therefore, you will often have commits in your local branch that have been committed with the wrong username and/or email ID. Step 1 :...
1293

How to squash commits using an interactive rebase

Reginald LynchApril 18th 2021, 5:05
To get started with this example, we need a new branch, namely rebaseExample3, which tracks origin/stable-3.1. Step 1 : Create the branch with the following command: git checkout -b rebaseExample3 --track origin/stable-3.1 Step 2 : Find a commit that is between origin/stable-3.1 and origin/stable-3.2, and list the commits in reverse...
1284

How to rebase selected commits interactively (Git)

Reginald LynchApril 17th 2021, 7:39
When you are working on a new feature and have branched from an old release into a feature branch, you might want to rebase this branch onto the latest release. When looking into the list of commits on the feature branch, you may realize that some of the commits are...
398

How to resolve conflicts during a Git rebase (Git)

Reginald LynchApril 18th 2021, 1:18
When you rebase a commit or a branch on top of a different HEAD, you may eventually see a conflict. If there is a conflict, you will be asked to solve the merge conflict and continue with the rebase using git rebase --continue. Step 1 : Check out the branch...
1083

How to rebase commits to another branch (Git)

Reginald LynchApril 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)

Reginald LynchApril 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)

Reginald LynchApril 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

Reginald LynchApril 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