top of page
  • dotsincloud

GIT Primer

"How to use Git to Make Changes to Code"


The scenario is that Development is working on an application called "ACME". We are tasked with making a change to the simple "ACME web application". Instead of the application main page header reading "Welcome ACME" the customer wants it to read “Welcome to the world of ACME” This text can be found in the project file views/index.ACME on GitHub.

1. Install git:

sudo yum -y install git

2. Configure the name and email address associated with git:

(This is a one-time configuration)

git config --global "<YOUR NAME>"

git config --global "<YOUR EMAIL>"

3. Create an SSH key (On Linux), using the default settings:

ssh-keygen -t rsa -b 4096

Display the contents of our new public key (be sure to copy the key to your clipboard):

cat /home/cloud_user/.ssh/

4. Log in to GitHub, navigate to Settings, click on SSH and GPG keys, and click on New SSH Key. Paste your public key information into this field and then click Add SSH key.

5. Create a Fork

Create a personal fork of the sample repository

6. Navigate to the URL

Click Fork in the top-right of the page.

Clone your personal fork from GitHub.

7. Click the green Clone or download button and copy the string that is displayed

8. In your terminal, run the following command:

cd ~ /

git clone<yourGITname>/cicd-pipeline-ACME-git.git

cd cicd-pipeline-ACME-git/

9. Create a feature branch to contain the change:

git checkout -b myBranch

10. Change the header text in views/index.ACME from “"Welcome ACME"” to “Welcome to the world of ACME”:

vim views/index.ACME

11. Add the change in views/index.ACME to the next commit:

git add .

12. Commit the change:

git commit -m "<UNIQUE MESSAGE>"

13. Push the Commit

Push the change to the remote SCM repository:

git config --global push.default simple

git push --set-upstream origin myBranch

14. Create a pull request to merge the feature branch into the master branch:

On the GitHub fork page, click Branches, locate myBranch under Your branches, and click New pull request.

In the top-left of the new pull request, change the base fork dropdown menu to your personal fork.

Click Create pull request

Merge the pull request

15. After a few moments, click the Merge pull request button

Click Confirm merge

The change is pushed.


We have installed Git, created a fork of a file, edited it to fulfill our needs, and pushed the change. Congratulations!

8 views0 comments
Post: Blog2_Post
bottom of page