DEV Community

Orestis Pantazos
Orestis Pantazos

Posted on

🛡️ DevOps Cheat Sheet

Git is the open source distributed version control system that facilitates GitHub, Bitbucket and GitLab activities on your desktop or laptop computer. This cheat sheet summarizes commonly used Git command line arguments for quick reference.

Configuration

The following command line arguments are to configure user information for all local repositories.

Sets the name you want attached to your commit transactions

git config --global user.name "Orestis Pantazos"

Sets the email you want attached to your commit transactions

git config --global user.email "opantazos@gmail.com"

Create repositories

When starting out with a new repository, you only need to do it once; either locally, then push to GitHub, or by cloning an existing repository.

Turn an existing directory into a git repository.

git init

Clone and download a repository that already exists on GitHub, including all of the files, branches and commits.

git clone https://github.com/orestispantazos/java-ee-kickoff-app

Branches

Branches are an important part of working with Git. Any commits you make will be made on the branch you are currently checkout out to. Use git status to see and check which branch that is.

Creates a new branch

git branch hotfix/test

Switches to the specified branch and updates the working directory

git checkout hotfix/test

Combines the specified branch's history into the current branch. This is usually done in pull requests, but is an important Git operation.

git merge hotfix/test

Deletes the specified branch

git branch -d hotfix/test

The .gitignore file

It may be a good idea sometimes to exclude files from being tracked with Git. This is typically done in a special file name .gitignore.

Synchronize changes

Synchronize your local repository with the remote repository on GitHub.com.

Combines remote tracking branch into current local branch.

git merge

Uploads all local branch commits to GitHub.

git push

Updates your current local working branch with all new commits from the corresponding remote branch on GitHub.

git pull

Note: git pull is a combination of git fetch and git merge

🔁 To Be Continued 🔁

Top comments (2)

Collapse
 
teaglebuilt profile image
dillan teagle

why is this tagged as devops?

Collapse
 
orestispantazos profile image
Orestis Pantazos • Edited

I will make it better for Docker, Kubernetes and Git. It is like a draft at the moment. I am saying also 🔁 To Be Continued 🔁. I am sorry for misunderstanding. Thank you in advance.