• 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 565 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 (22.1K 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

  • The Future Of Serverless: The Load-Intensive Workload Case May 25, 2022
  • Cutting Out The Coding: Serverless Computing In Action May 24, 2022
  • Types of Blackjack Variants: Discover the Different Versions of the Game May 23, 2022
  • How Cloud, Robotics And Sensor Technologies Are Changing The Business Landscape May 23, 2022
  • Modernizing Your Business With a Hybrid Cloud Strategy May 22, 2022

About This Article

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

Source:The Customize Windows, JiMA.in

This website uses cookies. If you do not want to allow us to use cookies and/or non-personalized Ads, kindly clear browser cookies after closing this webpage.

Read Privacy Policy.

PC users can consult Corrine Chorney for Security.

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

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

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