DEVOPS DAY 4

 

Explore GitHub
Create Centralized Repository in GitHub
Add existing project to GitHub
Setup Authentication in Local and GitHub
Git Clone
Git Push and Git Pull
Basics of Git Branches
Create Git Branches
Merge Git Branches
Fork GitHub existing project
Delete Git Branch
Q&A




> Explore GitHub
GitHub is a Git repository hosting service, but it adds many of its own features. While Git is a command line tool, GitHub provides a Web-based graphical interface. It also provides access control and several collaboration features, such as a wikis and basic task management tools for every project.
The flagship functionality of GitHub is “forking” – copying a repository from one user’s account to another.
Three features – fork, pull request and merge – are what make GitHub so powerful.
The fundamental software that underpins GitHub is Git itself, written by Linus Torvalds, creator of Linux. The additional software that provides the GitHub user interface was written using Ruby on Rails and Erlang by GitHub, Inc.       

Wiki: https://en.wikipedia.org/wiki/GitHub

    

> Concept of Branches
    Isolating features into different branches is a crucial practice for any serious developer.
       




> Create a Branch in Git
To create a branch, use the “git branch” command followed by the name of the branch.
git branch <branch_name>



> Creating a Branch using Checkout
To create a branch as well as switch to that newly created branch at a time:
git checkout –b <branch_name>




> Creating a Branch from a Commit
To create a branch from a previous commit on an existing branch.
git branch <branch_name> <commit_id>



> Creating a Branch from Another Branch
To create a branch from another branch:
git checkout –b <branch_name> <source_branch_name>


> Download Branch from Remote Repository
    git checkout –b <branch_name> origin/ <branch_name>
    git pull

           




           
> Merging Branches in a Local Repository

To merge branches locally, use git checkout to switch to the branch you want to merge into. This branch is typically the main branch. Next, use git merge and specify the name of the other branch to bring into this branch.   
    



> Merging Branches to Remote Repository

If a branch in your local repository, the remote repository is not aware of the branch’s existence. Before you can push the branch code in the remote repository, you set the remote repository as the upstream branch using the git push command. This command simultaneously sets the upstream branch and pushes the branch contents to the remote repository.    
    




> Delete Git Branch
Once work is completed on a feature, it is often recommended to delete the branch.    


> Deleting a branch LOCALLY
git branch -d <branch>

> Deleting a branch REMOTELY
git push origin --delete <branch>

    



Assignment:

 Create an account in GitHub
 Create a remote repo
 Pull source code from Remote repo to local system
 Create a file called “FirstPush.txt” and upload the file from local system to Remote repo
 Create a branch called “Team-A”
 Add a file called “Feature-A.txt” to Team-A branch.
 Push the newly created file to Branch-A.
 Merge Branch-A with Master branch.









Comments

Popular posts from this blog

DEVOPS DAY 5

DEVOPS DAY 2