Git Contd
- Lets create a change and add it to staging area (index)
- We can use restore command to move the changes from staging area to working tree
- Restore command can revert the changes from staging area and also working tree for any tracked files
- Lets try to delete one file which is tracked
- Lets try to delete one more file which is tracked
- Inspect your current commit id and make changes and add them to staging area, create untracked files
- Changes done
- Now i want to clean/remove all the changes done in working tree as well as staging area. I want my working tree to be as it was i.e. as the changes were in sixth commit
- Changes done
- Current State: We are at sixth commit.
- Overview
- We want our working tree to be as it was in commit (4)
- Note: Never use git reset –hard to go back to previous version if you dont have a remote repository, as you might not be able to undo changes
- In our system since we are executing the commands immedietly so there is less chance that garbage collection might have happened. Git maintains a log on its own for all the changes you make in your local repo which is called as reflog. we can seek the help from reflog to recover the lost commits (5 & 6)
- Exercise: In git there is also reset –soft option. Findout what soft does.
- Overview
- Generally when working on any application we might have to make parallel releases, such as v1.8, v2.0
- We need to use the concept of branching
- In Git when we initalize a repository a default branch called as
mastergets created.
