# Day 10 Task: Advance Git & GitHub for DevOps Engineers.


🏗***Git Branching:***
Use a branch to isolate development work without affecting other branches in the repository. Each repository has one default branch, and can have multiple other branches. You can merge a branch into another branch using a pull request.
🏗Please flow the process for Git branching and how to perform git branching
1. Create a new branch and Switch :
ubuntu@ip-172-31-14-151:~/devops-batch-05$ git checkout -b dev
Switched to a new branch 'dev'
ubuntu@ip-172-31-14-151:~/devops-batch-05$ git status
On branch dev
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
Devops/
file1.txt
nothing added to commit but untracked files present (use "git add" to track)
This command creates a new branch with the specified name but does not switch to it yet.
2. Make changes:
Now you are on the new branch, and you can make changes to your code.
3. Stage and commit your changes:
ubuntu@ip-172-31-14-151:~/devops-batch-05$ git add file1.txt
ubuntu@ip-172-31-14-151:~/devops-batch-05$ git add file3.txt
ubuntu@ip-172-31-14-151:~/devops-batch-05$ git status
On branch dev
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: Devops
new file: file1.txt
new file: file3.txt
🏗Git Revert and Reset:
Revert:
The git revert
command is used to create a new commit that undoes the changes made in a previous commit. This is a safe way to undo changes, as it does not alter the commit history; instead, it creates a new commit that undoes the changes made in a specified commit.
How to used the revert command in git please find below the snaps
Reset
The git reset
command is a powerful tool in Git that allows you to reset the current branch to a specific state. There are three primary forms of git reset
, each with different use cases:
🏗Git Rebase and Merge;
Merge
Git merge is a command that allows developers to merge Git branches while the logs of commits on branches remain intact.
The merge wording can be confusing because we have two methods of merging branches, and one of those ways is called “merge,” even though both procedures do essentially the same thing.
Rebase
Git rebase is a command that lets users integrate changes from one branch to another, and the logs are modified once the action is complete. Git rebase was developed to overcome merging’s shortcomings, specifically regarding logs.
🗼What is a push in GitHub;
In the context of GitHub, a "push" refers to the action of sending your locally committed changes to a remote repository. When you make changes to your local Git repository, such as creating new commits or branches, you can use the git push
command to upload those changes to a remote repository on GitHub.
Here's a basic workflow for pushing changes to GitHub:
Thanks for reading my blog. If you like my blog then follow my profile
Subscribe to my newsletter
Read articles from Pradeep chitroliya directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Pradeep chitroliya
Pradeep chitroliya
Hey there! I am Pradeep Chitroliya I am a Devops engineer, started writing articles on my DevOps and cloud journey. My purpose is to share the concepts that I learn, the projects that I build, and the tasks that I perform regarding DevOps. Hope you all find it useful.