GitLab – Rebase Operation


GitLab – Rebase Operation


”;


Description

Rebase is a way of merging master to your branch when you are working with long running branch.

Steps for Rebase Operation

Step 1 − Go to your project directory and create a new branch with the name rebase-example by using the git checkout command −

GitLab Rebase Operation

The flag -b indicates new branch name.

Step 2 − Now, create a new file and add some content to that file as shown below −

GitLab Rebase Operation

The content ”Welcome to Tutorialspoint” will be added to the rebase_file.md file.

Step 3 − Add the new file to working directory and store the changes to the repository along with the message (by using the git commit command) as shown below −

GitLab Rebase Operation

The flag -m is used for adding a message on the commit.

Step 4 − Now, switch to the ”master” branch. You can fetch the remote branch(master is a branch name) by using the git checkout command −

GitLab Rebase Operation

Step 5 − Next, create an another new file, add some content to that file and commit it in the master branch.

GitLab Rebase Operation

Step 6 − Switch to the rebase-branch to have the commit of master branch.

GitLab Rebase Operation

Step 7 − Now, you can combine the commit of master branch to rebase-branch by using the git rebase command −

GitLab Rebase Operation

Advertisements

”;

Leave a Reply

Your email address will not be published. Required fields are marked *