Posts

How to Add a Git note (Git)

Reginald LynchJune 23rd 2021, 3:52
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...
929

How to Add rebase with autosquash (Git)

Reginald LynchJune 22nd 2021, 11:26
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...
630

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

Reginald LynchJune 23rd 2021, 1:32
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 :...
1974

How to squash commits using an interactive rebase

Reginald LynchJune 23rd 2021, 5:06
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...
1638

How to rebase selected commits interactively (Git)

Reginald LynchJune 23rd 2021, 3:09
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...
708

How to resolve conflicts during a Git rebase (Git)

Reginald LynchJune 23rd 2021, 5:25
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...
1498

How to rebase commits to another branch (Git)

Reginald LynchJune 23rd 2021, 4:49
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...
754

How to Create an orphan branch (Git)

Reginald LynchJune 23rd 2021, 4:51
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...
2231

How to check the difference between branches (Git)

Reginald LynchJune 23rd 2021, 4:05
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...
674

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

Reginald LynchJune 23rd 2021, 4:55
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...
527