Tutorial on Git (A DevOps Must Know)

Knowing basic Git commands is critical to becoming a successful DevOps Engineer. In this article, I will go over basic GIT commands to create a Repo on GitHub and then review the Git Init, Git Clone, Git Status, Git add, Git -m comment and Git Push Origin Master commands.

Step 1: Create an account on GitHub (https://github.com/)

Step 2: In the top right corner, click on the ‘+’ sign to create a new Repo. You can name the repo anything that is appropriate to your project.

Step 3: With Command Prompt, go to your project or a create a new folder where you want to keep your code.

Step 4: Run ‘git init’ in the same project/folder in step 3. Open up your terminal and/or command prompt. Copy and paste:

along with the command ‘git clone’ + the HTTPS URL.

Step 5: In the same directory as your code, type ‘git add’ and the name of your class to add this class into GitHub

Step 6: Use ‘git status’ to see if your git add has been added.

Step 7: Use ‘git commit -m “Comment/description” to be included with your git add.

Step 8: To add onto the master branch, type the command ‘git push origin master’

Step 9: Confirm on GitHub that your code has been added:

Congratulations, you have used your first git commands!