DevOps90DaysChallenge

DevOps90DaysChallenge

Hi 👋there,

Now we are on the Day 10 task

Advance Git & GitHub(Rebase, Merege,Revert, Branching).

Checkout the below link for Day 10 task:

https://github.com/LondheShubham153/90DaysOfDevOps/blob/master/2023/day10/tasks.md

Git Branching

Git branching is a feature in the Git version control system that allows developers to create multiple independent branches of their codebase, enabling them to work on different features or fixes simultaneously without affecting the main codebase.

Changes made to a branch can be merged back into the main codebase once they are complete and have been reviewed. Git branching is a powerful tool that allows developers to manage code changes more efficiently and collaboratively.

Git Revert and Reset

Git revert undoes a specific commit by creating a new commit that undoes the changes made by the original commit. This is a safe way to undo changes, as it does not change the commit history and allows you to easily undo the undo if needed.

Git reset, on the other hand, allows you to move the current branch to a specific commit, which can potentially change the commit history. It’s important to use reset with caution, as it can cause data loss and make it difficult to undo changes.

What Is Git Rebase?

Git rebase is a command that allows you to apply the changes from one branch to another. This can be useful for keeping your branch up-to-date with changes made in a separate branch or for creating a linear history before merging your changes into the main branch.

What Is Git Merge?

Git merge is a command that allows you to combine the changes from two or more branches into a single branch. When you run git merge, Git will automatically try to merge the changes made in the source branch into the target branch.

If there are no conflicts between the changes, Git will create a new commit that includes all the changes from the merged branch. If there are conflicts, Git will prompt you to manually resolve them before the merge can be completed.

Merging is a common way to integrate changes from other branches into your working branch. It creates a new commit that represents the combination of changes.

TASK 1 :

Add a text file called version01.txt inside the Devops/Git/ with “This is the first feature of our application” written inside. This should be in a branch coming from master, [hint try git checkout -b dev], switch to the dev branch ( Make sure your commit message will reflect as "Added new feature"). [Hint use your knowledge of creating branches and Git commit command]

  • version01.txt should reflect at the local repo first followed by the Remote repo for review. [Hint use your knowledge of Git push and git pull commands here]

Add a new commit in dev branch after adding the below-mentioned content in Devops/Git/version01.txt: While writing the file make sure you write these lines

  • 1st line>> This is the bug fix in the development branch

  • Commit this with the message “ Added feature2 in development branch”

  • 2nd line>> This is gadbad code

  • Commit this with the message “ Added feature3 in the development branch

  • 3rd line>> This feature will gadbad everything from now.

  • Commit with the message “ Added feature4 in the development branch

2. Create a new Branch “dev” and commit the changes

3. Use the git reset command to go back to the correct file. And after that switch to the main branch

4. Merge the dev branch to the main branch and push the changes to the remote Repository

5. Changes are Updated on Remote Repository

Task 2:

  • Demonstrate the concept of branches with 2 or more branches with a screenshot.

  • add some changes to dev branch and merge that branch in master

  • as a practice try git rebase too, and see what difference you get.

  • Please, feel free to drop any questions in the comments below. I would be happy to answer them.

  • If you find this post helpful😊🙂, please follow and click the heart❤❤ button below to show your support.

  • _ Thank you for reading

  • _sandhya kumari