Git Tutorials – Git Commands
DevOpsUniversity
Official, Most Trusted DevOps Certifications. We are helping Organizations to build high performing DevOps teams.
What is Git?
GIT is an open source Distributed Version Control System (DVCS) which records changes made in your project or a set of files laying emphasis on speed, data integrity and distributed, non-linear workflows.
Git is one of the best version control tools available in the present market. This emerging star was first developed by Linus Torvalds, the creator of the Linux kernel. There is no singular centralized code base that the code can be pulled from, and different branches are responsible for hosting different areas of the code. Git is fast and efficient and is used by system administrators and open-source projects to power their repositories.
Goals of Git:
Each update in the code is recorded in Git’s history, which is stored in a data structure called a Git repository. This repository is the core of Git.
Why Git?
Feature branch workflow
Each branch function in an isolated environment while updates are made in the codebase. This way, its ensured that the master branch always has the production-quality code
Pull Requests
Community
Git Basics
File States
There are three main states that your Git files can reside in:
The remote repository (git directory) is the server where all the collaborators upload changes made to the file, it is where the work from all developers gets integrated.
Basic Git Workflow
Branching & Merging
Features Of Git
Git: A Giant Leap Toward DevOps
DevOps is about completely removing process bottlenecks, quicker feedback, shortening development cycle and improving overall software lifecycle.
A sensible way to start on the DevOps path is to learn how to use a version control system such as Git. Git is an integral part of DevOps.
Git plays an important role in managing the code that the collaborators commit to the shared repository. This code is then extracted to perform continuous integration, to create a build and test it on the test server and finally deploy it on the production.
Git enables communication between the development and operations team, commit messages play a vital role in information exchange. The deployable bits and pieces all lie in the Version Control system like Git.
Git alone might not be able to overcome the barriers between Dev and Ops but it surely provides some remarkable capabilities that make a big difference to the IT organizations, giving substantial benefits, like :
Git provides both the capabilities that characterize high performing IT organizations: version control of production artifacts and peer review of updates. Let us now look at the Git Commands.
Git Commands
Installing Git on Windows
Step 1: Go to https://www.git-scm.com/ . Click on Download [latest version] for Windows.
Step 2: You will view the below screen. Download has started and the .exe file is downloading.
Step 3: Click on Next when this popup window opens.
Step 4: Check the below options and click Next.
Step 5: The below screen comes. Click Next.
Step 6: Choose the appropriate option and click Next.
领英推荐
Step 7: Choose the library option and click on Next.
Step 8: Choose the checkout option and click Next.
Step 9: Choose the emulator and click Next.
Step 10: Choose configuration options and click on Install.
Step 11: Once the installation completes, the Git GUI opens.
After installing Git in your Windows system, just open your folder/directory where you want to store all your project files; right click and select ‘Git Bash here’.
We will run the commands on Windows and operations using Git Bash. Git Bash is a text-only command line interface for using Git on Windows which provides features to run automated scripts.
Now, let us open Git Bash and run some Git commands :
1. $ git init “[repository-name]”
To view the git folder, you use the command ls -la as it is a hidden folder.
2. $ git config
3. $ git add . or git add [filename]
4. $ git commit
5. git status
6. git checkout -b [branchname]
7. git log
8. git ls-files –stage
9. git diff
10. git merge
Installing Git on AWS
On AWS, after login, go to EC2 instances and connect to your VM instance.
Once you have connected to the VM, run the following command to install Git.
To check the version of Git installed
The rest of the git commands for operations related to repository like $ git init etc, will remain the same as mentioned above, in the case of Windows. You can run them in similar manner.
Free Webinar : Taking DevOps Monitoring to the Next Level- Step by Step
Join our FREE webinar and unlock the secrets to Taking DevOps Monitoring to the Next Level- Step by Step.
Register here:
Join our WhatsApp group for Updates:
We'll guide you through the process of revolutionizing your monitoring practices, from identifying bottlenecks to implementing cutting-edge solutions.
Say goodbye to outdated monitoring methods and hello to a more efficient, streamlined approach.
Secure your spot now and let's embark on this transformative journey together. See you there!