LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-07-2019, 07:59 AM   #1
linuxdad
LQ Newbie
 
Registered: Nov 2019
Location: Delhi
Distribution: Centos
Posts: 1

Rep: Reputation: Disabled
What is git reset ?


If you are a developer or devops engineer, then this tutorial is going to be very useful for you. Here we will try to understand concept of git reset or you can say git revert and all related question like what does git revert, why we should use it and how many types of git revert.

Understand Git Reset
Git reset means to restore repository at a particular version. Let’s move a little bit deeper and take a real time scenario. Suppose we are working on a product and we have delivered 10 version to client of that product. Now client want a new feature.

Now developers have two options they can start coding from starting for new feature that will wastage of time and resource because already we have written our raw code. No need to write raw code again and again. Now second way is suppose up to 7 version of our raw code is same so we can reset our repository up to version 7 and can start work next. That will be easy and time saving.

Type of git reset
Mind it after restore point all commit id will delete. Our data or latest changes will delete or not it depend on type of reset. So, there are mainly three type of git reset.

Soft reset
In case of soft reset all commit id will delete after restore point but all latest changes or you can say data will remain as it is means data will not delete from latter on version from restore point. Let’s take an example suppose we have a repository with name test, and we have total 4 version into that repository.

As shown below figure. Suppose we want to reset this repository at version 2. When we will reset this repository at version 2 then after version 2 all commit will delete but changes of version 3 and 4 will remain as it is as before.

So now my question is when we should use soft reset. Let’s take a scenario suppose our commit id become more. Then more commit id will create confusion. But our all commit are tested and working fine so we can make final commit from all commit that will help to troubleshooting any issue easy. For better understanding go throw from below diagram once.
For more visit :-- [link removed]

Last edited by rtmistler; 11-07-2019 at 08:13 AM.
 
Old 11-07-2019, 08:13 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
The forum rules do not permit advertising. Please visit http://www.linuxquestions.org/advertising/ for more information on advertising. Feel free to contact the forum admin if you have any questions about this policy.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Gitpod git-bolts git-IDE onto GitHub for in-browser code git-editing LXer Syndicated Linux News 0 09-05-2018 04:50 AM
[SOLVED] Can't install Git repo (I don't git git ) Nemus Linux - Software 3 05-20-2011 02:09 PM
SBo-git - slackbuilds.org on git (with patches for current) ponce Slackware 47 03-12-2011 05:12 AM
why is git scm named 'git'? hottdogg Linux - General 5 02-03-2009 07:25 AM
inconsistency issue of git-clone ***/git/mesa/drm with the existing kernel source centguy Linux - Desktop 2 10-08-2008 10:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration