Cloudbooklet
  • News
  • Artificial Intelligence
  • Applications
  • Linux
No Result
View All Result
Cloudbooklet
  • News
  • Artificial Intelligence
  • Applications
  • Linux
No Result
View All Result
Cloudbooklet
No Result
View All Result
Home Google Cloud

How Git Works – 7 Basic Steps for Beginners

by Cloudbooklet
3 years ago
in Google Cloud
How Git Works - 7 Basic Steps For Beginners
ShareTweetSendShare
Readers like you help support Cloudbooklet. When you make a purchase using links on our site, we may earn an affiliate commission.

Git is a distributed version control system created by Linus Torvalds in 2005. It also has an excellent support for branching, merging, rewriting repository history and more. Git is considered to be the modern standard for software development. In this guide you are going to learn the basics of git workflows like Create a repository […]

ADVERTISEMENT

Git is a distributed version control system created by Linus Torvalds in 2005. It also has an excellent support for branching, merging, rewriting repository history and more. Git is considered to be the modern standard for software development.

In this guide you are going to learn the basics of git workflows like

  1. Create a repository (project).
  2. Clone (copy) your repository to your local machine
  3. Add a file to your local repository and commit (save) the changes.
  4. Push the changes to your main branch.
  5. Create a branch (version), make commit, push changes to the new branch.
  6. Open a pull request (propose changes to master).
  7. Merge your branch to master branch.

Prerequisites

Install Git on your system or server. Learn how to install Git on Ubuntu.

ADVERTISEMENT

Step 1: Create new Repository

To create a new repository go to your development platform like GitHub or BitBucket or GitLab and follow the guide to create new repository.

You might also like

How To Setup Ssh Keys On Ubuntu

How to Setup SSH Keys on Ubuntu 20.04

4 months ago
Draggan Ai Editing Tool Install And Use Draggan Photo Editor

DragGAN AI Editing Tool Install and Use DragGAN Photo Editor

4 months ago

Here is guide on how to create a new repository in GitHub.

Create New Repository
How Git Works - 7 Basic Steps for Beginners 1

Initialize Git

Now you need to configure Git with your name and email so that Git associates your identity with every changes you make.

ADVERTISEMENT
git config --global user.name "Your Name"
git config --global user.email "[email protected]"

Step 2: Clone your repository

Create a new folder in your local system and navigate to your project folder and you can clone the repository that you created in the previous step.

Copy the SSH url from your repository.

ADVERTISEMENT
Clone Repo

Now you can use the clone command to pull the repository.

git clone ssh_url .

You need to specify the “.” at the end of the command so that the files will be cloned directly into the local folder.

ADVERTISEMENT

Step 3: Add new File and Commit

As you have the repository cloned to your local system, it is time to start the development process.

Now you can create a new file using the touch command.

ADVERTISEMENT
touch filename.txt

This command will create a new file with the provided name inside your current directory.

Now you can check the status of your repository using the git status command.

Git Status

You will see something similar to the above screenshot which indicates the new file that is created is not tracked.

Now you can use the add command to tell git to track the file.

git add filename.txt

Now if you check the status again you will see the new file added.

Git Add

Now use the commit command to save the changes.

git commit -m "Initial Commit"

You will receive an output similar to the one below.

Git Commit

Step 4: Push changes to branch

Now you can push your changes to your remote repository using the push command.

git push -u origin branch_name
Git Push

Now if you take a look at your project in GitHub or BitBucket you will see the new file gets added.

Step 5: Create new branch

Create the branch on your local machine and switch in this branch:

git checkout -b new_branch_name

Now you need to push the changes to remote.

git push origin new_branch_name

Step 6: Create Pull Request

Go to GitHub repository, you will see a notification to perform a pull request or you can go to the Pull Request tab and initiate a New Pull Request

 Pull Request

Once the pull request is created you can accept and merge it or you can revise the code.

Step 7: Merge Branch

Now you can accept and merge your branch with the main branch.

Merge

Delete a Branch

To delete a branch you can delete the branch in local and apply the changes to the remote.

git branch -d branch_name
git push origin :branch_name

Conclusion

Now you have learned how to perform basic operations in git like create repo, clone, new branch, pull request, delete branch. etc

Thanks for your time. If you face any problem or any feedback, please leave a comment below.

Tags: Git
ShareTweetSendShare
Cloudbooklet

Cloudbooklet

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Related Posts

Set Up Deep Learning With Nvidia, Cuda, Cudnn On Ubuntu

How to Set Up Deep Learning with Nvidia, CUDA, cuDNN on Ubuntu 22.04

7 months ago
How To Install Or Upgrade Php 8.2 On Ubuntu 22.04

How to Install or Upgrade PHP 8.2 on Ubuntu 22.04

9 months ago
How To Change Timezone On Ubuntu 22.04

How to Change Timezone on Ubuntu 22.04

1 year ago
How To Install Ansible On Ubuntu 22.04

How to Install Ansible on Ubuntu 22.04

1 year ago

Follow Us

Trending Articles

Wix Ai

Create a Professional Website with Wix AI Website Builder

September 19, 2023

Google Bard Extensions: How to Link Your Gmail, Docs, Maps, and More to an AI Chatbot

Microsoft Unveils New Disc-Less Xbox Series X with Lift-to-Wake Controller

Top 10 Advantages of a Cloud VPS Server

5 Free AI Soulmate Maker: Create Your Perfect Match

How to Create and Customize Stunning Contact Poster on iPhone

Popular Articles

Free Watermark Maker

5 Free Watermark Maker: Create Transparent Watermarks for Images Online

September 15, 2023

Microsoft Designer: AI Design Tool Now Available in Edge

Top 10 AI Presentation Maker: Easy Way to Create Stunning Presentations

10 Best Gay Dating Apps to Use in 2023

How to Block YouTube Ads on Android TV in 2023 (6 Easy Methods)

Top 10 AI Writing Assistant Tools: Detailed Review and Comparison

Subscribe Now

loader

Subscribe to our mailing list to receives daily updates!

Email Address*

Name

Cloudbooklet Logo

Welcome to our technology blog, where we explore the latest advancements in the field of artificial intelligence (AI) and how they are revolutionizing cloud computing. In this blog, we dive into the powerful capabilities of cloud platforms like Google Cloud Platform (GCP), Amazon Web Services (AWS), and Microsoft Azure, and how they are accelerating the adoption and deployment of AI solutions across various industries. Join us on this exciting journey as we explore the endless possibilities of AI and cloud computing.

  • About
  • Contact
  • Disclaimer
  • Privacy Policy

Cloudbooklet © 2023 All rights reserved.

No Result
View All Result
  • News
  • Artificial Intelligence
  • Applications
  • Linux

Cloudbooklet © 2023 All rights reserved.