Case Study - Git
Case Study - Git
Local Operations :-
1] Create a new local git repository on to your machine and configure it for
2] Create a files in directory (File1, IgnoreFile and FileToDelete provided), say directory contains –
File1.txt, IgnoreFile.txt and FileToDelete.txt, now start tracking only the File1.txt and FileToDelete.txt,
and ignore the IgnoreFile.txt by using .gitignore.
Use commit message as “This is First Commit, Tracking File1 and FileToDelete”
Note: - only File1.txt and FileToDelete.txt should be tracked and not the IgnoreFile.txt
Change2 in File1
Change1 in File1
5] Delete the FileToDelete.txt file from directory and commit with message as “FileToDelete is deleted”
6] Display logs:-
- Show only commits that occur between from date and to date
1] Create a branch ‘bug’, checkout to bug branch to solve the bug in file1.
2] Commit this change with message as “Bug Resolved – Space added between numerical and letters”
- Create new branch ‘idea’ and make a new commit on ‘idea’ branch
master
A B C D
E
idea
master
A B C D E
8] Now say bug is resolved and you are good to release this stable version, tag this release as ‘v1.0’ with
message as “Stable version 1.0 released”.
9] Consider the following scenario to work with Stashing:-
Checkout to ‘bug123’ branch first and add text as “Change 3” in File1.txt, stage this change and don’t
commit the same so that you can get a dirty state of working directory.
Now assume that you have a priority task to be made on master branch, checkout to master and store
this dirty state (on ‘bug123’) to stash so that you get back to this state later.
11] Checkout to ‘bug123’ branch, reapply the stash which is stored recently and finally commit this
change with the message as “Change 3 in File1”
Git Remote:-
7] Now create a new file as ‘RemoteFile.txt’ on remote repository, make 1 commit by making following
change in the RemoteFile.txt
And if you check the log on remote it should display in following manner:-
Change1 in RemoteFile
Note: - If you check log on local there will be no commits which are made on remote.
8] Fetch remote ‘Origin’ to synch up with remote.
10] Now, make 1 more commit on remote (GitHub) by making following change in the RemoteFile.txt
And if you check the log on remote it should display in following manner:-
Change2 in RemoteFile
Change1 in RemoteFile
12] Now, make 2 new commits on local by making following change in the RemoteFile.txt
And if you check the log on local it should display in following manner:-
Change4 in RemoteFile
Change3 in RemoteFile
Change2 in RemoteFile
Change1 in RemoteFile