0% found this document useful (0 votes)
1K views6 pages

Module 2: Version Control With Git: Assignment - 1 Solution

The document discusses setting up a Git source code management system for a company. It describes creating a local Git repo, adding a code base, making changes in a new branch, merging the branch back to master, and pushing the local repo to a remote Github repo.

Uploaded by

Nikhil Sahoo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views6 pages

Module 2: Version Control With Git: Assignment - 1 Solution

The document discusses setting up a Git source code management system for a company. It describes creating a local Git repo, adding a code base, making changes in a new branch, merging the branch back to master, and pushing the local repo to a remote Github repo.

Uploaded by

Nikhil Sahoo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

DevOps Certification and Training

Module 2: Version Control with Git

Assignment - 1 Solution

© Brain4ce Education Solutions Pvt. Ltd.


Module 2: SCM With Git

Problem Statement

Three Developers are working in Aperture Technology co. Their company wants a better Source
Code Management System because the earlier tool had the tendency to save redundant code.
Multiple Developers working simultaneously on the same block of code also caused problems.
You are Mike, and your manager has given you the task of moving the company’s code base to
git and Github.

Action Items
• Create a local git repository and move the entire code base to it
• Create a new branch for a new feature you want to add to the application
• Merge back the created branch with the master branch
• Create a remote repository
• Push the local repository to company’s remote repository
Link to download the code base

Solution

1. Move to your Source Code directory and initialize a git repo in that folder

Syntax: git init

©Brain4ce Education Solutions Pvt. Ltd Page 1


Module 2: SCM With Git

2. Add all the files in the repository to the staging area

Syntax: git add .

3. Now commit these files to the local repository

Syntax: git commit

©Brain4ce Education Solutions Pvt. Ltd Page 2


Module 2: SCM With Git

4. Create a new feature branch and switch to it

Syntax: git branch branchName


git checkout branchName

5. Make the required changes to the source files and then do a git diff to check all the
changes

Syntax: git diff

6. Now add the changed files to the staging area

Syntax: git add fileName


OR git add .

7. Commit the changes

Syntax: git commit

©Brain4ce Education Solutions Pvt. Ltd Page 3


Module 2: SCM With Git

8. Now switch back to master and merge the feature branch back into the master

Syntax: git merge branchName

9. Now, create a remote repository on your Github account.

10. Add the remote repository to your local repo

Syntax: git remote add origin repoURL

11. Push the local repository onto the remote repository

Syntax: git push -u origin master

©Brain4ce Education Solutions Pvt. Ltd Page 4


Module 2: SCM With Git

©Brain4ce Education Solutions Pvt. Ltd Page 5

You might also like