Git

How to Tag commits in the repository (Git)

August 1st 2021, 4:04
Before we start, you must go to the jgit directory, where we made the original clone for this post. We should start by tagging the commit that is ten commits behind origin/stable-2.3 and is not a merge. In order to find that commit, we will use the git log command....
809

How to Push Git notes to a remote repository (Git)

August 1st 2021, 9:05
Before we can push the notes from the shareNotes repository, we have to create a note to be pushed, as the notes we have now are all available on the remote repository. The remote repository in this case is the jgit directory: Step 1 : You have found a commit...
1215

How to Retrieve notes from the remote repository (Git)

August 2nd 2021, 1:38
we need another clone from the local clone we already have. This is to show the push and fetch mechanism of Git with git notes. Step 1 : Start by checking out the master branch: git checkout master Step 2 : Now, create a local branch of all the stable-3.1...
683

How to Separate notes by category (Git)

August 1st 2021, 9:04
As we saw in the previous example, we can add notes to the commits; however, in some cases, it makes sense to store the information sorted by categories. Notes are stored in refs/notes/commits, but we can add multiple references so that we can easily sort and list the various scopes...
625

How to Add a Git note (Git)

August 2nd 2021, 1:12
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...
1171

How to Add rebase with autosquash (Git)

August 1st 2021, 4:10
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...
752

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

August 1st 2021, 8:24
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 :...
2402

How to squash commits using an interactive rebase

August 2nd 2021, 12:17
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...
1975

How to rebase selected commits interactively (Git)

August 2nd 2021, 12:46
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...
863

How to resolve conflicts during a Git rebase (Git)

August 2nd 2021, 2:10
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...
1689