Most Useful Git Commands

by | Sep 6, 2023 | Learn | 0 comments

Git commands you should know:

  1. git init: Initializes a new Git repository in the current directory.

  2. git clone [repository_url]: Creates a copy of a remote repository on your local machine.

  3. git add [file]: Stages changes for commit. You can use git add . to stage all changes.

  4. git commit -m “Commit message”: Commits the staged changes with a descriptive message.

  5. git status: Shows the current status of your working directory, including staged and unstaged changes.

  6. git log: Displays a log of all commits, including their hashes, authors, dates, and commit messages.

  7. git branch: Lists all branches in your repository, highlighting the current branch.

  8. git checkout [branch_name]: Switches to a different branch. You can also use it to create new branches with -b.

  9. git merge [branch_name]: Merges changes from the specified branch into the current branch.

  10. git pull: Fetches changes from a remote repository and merges them into your current branch.

  11. git push: Pushes your local changes to a remote repository.

  12. git remote -v: Lists all remote repositories associated with your project.

  13. git fetch: Fetches changes from a remote repository without automatically merging them.

  14. git reset [commit]: Unstages changes, or moves the HEAD to a specific commit.

  15. git stash: Temporarily saves changes that are not ready to be committed.

  16. git tag [tag_name]: Creates a lightweight tag for a specific commit.

  17. git diff: Shows the difference between your working directory and the last commit.

  18. git blame [file]: Shows who last modified each line of a file and when.

  19. git remote add [remote_name] [remote_url]: Adds a new remote repository.

  20. git remote remove [remote_name]: Removes a remote repository.

0 Comments

Related Posts

Delegates in C#: Complete tutorial

Learn Delegates c# In C#, a delegate is a type that represents references to methods with a particular parameter list and return type. Delegates provide a way to encapsulate a method, and they are often used for defining callback methods and implementing event...

Inheritance in C# oops complete guide

Inheritance Table of content: Topics1Why i wrote this article2Inheritance - complete guide3All possible scenarios based/ tricky in/out type of Interview questions Why i wrote this article? When I was preparing c#/oops, the main challenge was information was scattered...

Learn Angular Directives

Angular Directives Angular directives are an essential part of the Angular framework, allowing you to extend the HTML vocabulary to build dynamic and interactive web applications. There are three main types of directives in Angular: Components: Components are the most...

.Net Core Garbage Collector

Garbage collection   Garbage collection (GC) in .NET Core is an automatic memory management technique that reclaims unused memory. It simplifies memory management for developers and reduces memory leaks and bugs.   The GC identifies and collects objects that...

.Net Core Introduction

INTRODUCTION .NET Core is a modern, cross-platform, and open-source development platform developed and maintained by Microsoft. It provides developers with a fast, flexible, and modular framework for building applications for Windows, Linux, macOS, iOS, and Android....

.Net Framework Basics CLR CTS CTS MSIL

CLR (Common Language Runtime) Responsible for program execution in .Net Framework Some crucial role of CLR- Memory Management: The CLR is responsible for managing memory allocation and deallocation in .NET applications. It includes automatic memory management through...

Index:Learn

Delegates in C#: Complete tutorial

Learn Delegates c# In C#, a delegate is a type that represents references to methods with a particular parameter list and return type. Delegates provide a way to encapsulate a method, and they are often used for defining callback methods and implementing event...

Inheritance in C# oops complete guide

Inheritance Table of content: Topics1Why i wrote this article2Inheritance - complete guide3All possible scenarios based/ tricky in/out type of Interview questions Why i wrote this article? When I was preparing c#/oops, the main challenge was information was scattered...

Learn C# oops Polymorphism

Polymorphism Simplifying Polymorphism in C# with Examples Polymorphism is a fundamental concept in object-oriented programming (OOP), and it can be understood more easily by breaking it down into its key components. What is Polymorphism? At its core, polymorphism...

Learn Angular Directives

Angular Directives Angular directives are an essential part of the Angular framework, allowing you to extend the HTML vocabulary to build dynamic and interactive web applications. There are three main types of directives in Angular: Components: Components are the most...

.Net core Fun FACTS to choose other backend but NOT .Net Core

Funny Excuses to Avoid Learning and Using .NET Core for Your Next Backend Web API (And Why You Should Consider Node.js and Other Popular Alternatives Instead) In the world of backend web development, there are numerous technologies to choose from. One option that...

.Net Core Garbage Collector

Garbage collection   Garbage collection (GC) in .NET Core is an automatic memory management technique that reclaims unused memory. It simplifies memory management for developers and reduces memory leaks and bugs.   The GC identifies and collects objects that...

Commonly used commands for .net Core Good to remember

Most userful commands for .net Core. Good to remember. dotnet new: This command is used to create a new project based on a specified template. It generates the basic structure and files required for a .NET Core application. Example: dotnet new console dotnet clean:...

.Net Core Introduction

INTRODUCTION .NET Core is a modern, cross-platform, and open-source development platform developed and maintained by Microsoft. It provides developers with a fast, flexible, and modular framework for building applications for Windows, Linux, macOS, iOS, and Android....

.Net Framework Basics CLR CTS CTS MSIL

CLR (Common Language Runtime) Responsible for program execution in .Net Framework Some crucial role of CLR- Memory Management: The CLR is responsible for managing memory allocation and deallocation in .NET applications. It includes automatic memory management through...

.Net Core vs .Net Framework differences

CLR vs Core CLR What is CoreCLR The CoreCLR provides many similar functionalities as the CLR, but it is specifically designed for the cross-platform nature of .NET Core. General CLR feature includes features like Just-In-Time (JIT) compilation, garbage collection,...

Understand Middleware in .Net Core

Middleware is a piece of software that handles http request and response. In simple term, .net core works with middleware in order to enhance performance of our application rather than having big chunk of framework component/ libraries at once, for which most of the...

Learn How .Net Core Hosting Works

Hosting In .NET CoreIn ASP.NET Core, there are two hosting models available: in-process hosting and out-of-process hosting.In-process Hosting (Default): In the in-process hosting model, a single web server (e.g., IIS) is used directly to host the application. To...