• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » Few Common and Useful Git Commands

By Abhishek Ghosh January 24, 2022 8:15 am Updated on January 24, 2022

Few Common and Useful Git Commands

Advertisement

Git is a distributed version control system that differs in some characteristics from typical version control systems. Both branching and merging two or more branches are integral parts of working with Git and are built into the Git tools. Git contains programs that make it easy to visualize the non-linear history of a project and navigate that story. Branches in Git are implemented very effectively (unlike other SCMs) – a branch represents only a reference, reff or short, a text file with a commit ID, which is stored in a repository in the directory (e.g. for the master branch) and refers to a specific commit. The branch structure can be reconstructed using its parental commits. Through these properties, very large and efficient development structures can also be realized, as with Git itself or the Linux kernel, in which each feature and each developer has a branch or its repository, from which the project manager (“maintainer”) can then transfer commits via a merge or cherry-pick (use of individual commits) into the main branch of the project (master).

Each user owns a local copy of the entire repository, including the history. This allows most actions to be performed locally and without network access. No distinction is made between local development branches and development branches of remote repositories. Although there is no technical difference between different repositories (except that between normal and bare repositories on servers where there is no working tree, i.e. the real files), the copy referenced from a project homepage is often considered the official repository to which the developers’ revisions are transferred. There are special remote-tracking branches. These are references (see Non-Linear Development) that point to the state of another repository.

Few Common and Useful Git Commands

# Create and checkout new branch based on the current branch
git checkout -b

Advertisement

---

# Undo all local pending changes
git reset –hard HEAD

# Erase the last 3 commits
git reset –hard HEAD~3

# Undo a single file change
git checkout —

# Push the new branch to the server
git push origin

# Delete remote branch
git push origin –delete

# List all local and remote branches
git branch -a

# Remove remotely deleted branches (this will not delete local branches, but delete only the copies of remotes)
git remote prune origin

# Pull remote master branch and merge it into the current branch
git pull origin master

# Undo the last commit but keep changes unstaged
git reset HEAD~1

# Rename current branch
git branch -m

# Save changes temporarily – branch independent
git stash

# List temporary saves
git stash list

# Apply temporarily saved changes
git stash apply

# Delete temporary saves
git stash drop

# Delete untracked files and directories (-n to just test)
git clean -fd

# Resolve conflict by accepting their changes
git checkout –theirs

# Interactive stage / unstage
git add -i

# Compare branch to another branch
git diff

#display all changes with additions/deletions between two branches
git diff –stat master..

#display the active branches
git branch -va –sort=committerdate

This Article Has Been Shared 244 Times!

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Few Common and Useful Git Commands

  • What is Code Refactoring?

    In software development, code refactoring refers to the manual or automated structural improvement of source code while maintaining observable program behavior. The aim is to improve readability, comprehensibility, maintainability and extensibility, with the aim of significantly reducing the respective effort for error analysis and functional enhancements. Code refactoring is a central part of Agile software […]

  • What Should We Know About Software Quality

    In software engineering, software quality is an overall appreciation of software, based on many indicators. Completeness of functionality, correction and accuracy of results, reliability, fault tolerance, ease and flexibility of its use, simplicity, extensibility, compatibility and portability, ease of correction and transformation, performance, consistency and integrity of the information it contains are all quality factors. […]

  • Why Do You Need a Facility Management Software?

    Facility managers are responsible for ensuring that the systems in and around buildings remain harmonious. This starts with the operation and management of technical facilities and extends to property management. To be able to handle these many tasks efficiently, safely and sustainably, many facility managers use Computer Aided Facility Management – CAFM software. How do […]

  • HR Trends and Challenges To Watch Out For in 2022

    The professional world has witnessed umpteen changes in the last year and a half in the wake of the Covid-19 pandemic. In the same sequence, HR practices have been impacted by the sudden changes in the work environment, including the dependence on remote work, the hiring process, and training. There have been visible changes like […]

  • Demarcation of Orchestration and Choreography

    Service composition is a term used in computer science to describe the way services are linked. Since the term is mostly used in the field of service-oriented architecture, it is also common under Web Service Composition. Two types of compositions are distinguished: orchestration and choreography. Service composition can consist of one or both types. Orchestration […]

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • What is Voice User Interface (VUI) January 31, 2023
  • Proxy Server: Design Pattern in Programming January 30, 2023
  • Cyberpunk Aesthetics: What’s in it Special January 27, 2023
  • How to Do Electrical Layout Plan for Adding Smart Switches January 26, 2023
  • What is a Data Mesh? January 25, 2023

About This Article

Cite this article as: Abhishek Ghosh, "Few Common and Useful Git Commands," in The Customize Windows, January 24, 2022, February 1, 2023, https://thecustomizewindows.com/2022/01/few-common-and-useful-git-commands/.

Source:The Customize Windows, JiMA.in

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT