• 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

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

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • OpenShift OctoPress Auto install Script

    OpenShift OctoPress Auto install Script is an Advanced Script to Run OctoPress on Free OpenShift PaaS Practically Without Any Knowing Ruby or Git.

  • WordPress & PHP : Different AdSense Units on Mobile Devices

    Here is How To Serve Different AdSense Units on Mobile Devices on WordPress With PHP. WordPress Has Function Which Can Be Used In Free Way.

  • Git with Subversion for WordPress Plugin Development Detailed Guide

    Git with Subversion for WordPress Plugin Development Detailed Guide Explains How To Use Git like GitHub, your Mac and WordPress to Keep Plugins Updated.

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

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
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