You are on page 1of 17

Academic Year 2021-22

DEPARTMENT OF INFORMATION TECHNOLOGY


COURSE CODE: DJ19ITL602 CLASS: TY BTech
COURSE NAME: Software Engineering Laboratory

EXPERIMENT NO. 9

LO:

1. To understand different Version Control tools like GIT, CVS or Mercurial

AIM: To Perform Version Control on any project using any Version control tool (GIT). To
study various commands to install and organize your files in the repository and their
implementation. Commands for understanding/ implementing Git version, set configuration
variables, make new directory & access it, start a new project with Git, Git status and Git add,
commit, log, clone, Pull and Push.

THEORY:
 Git is a free and open-source distributed version control system designed to handle
everything from small to very large projects with speed and efficiency.
 Git is easy to learn and has a tiny foot print with lightning-fast performance.
 Git is a version control system for tracking changes in computer files and coordinating
work on those files among multiple people. It is primarily used for source code
management in software development, but it can be used to keep track of changes in
any set of files.
 It outclasses SCM tools like Subversion, CVS, Perforce and ClearCase with features
like cheap local branching, convenient staging areas, and multiple workflows.
 Some of the basic operations in Git are:
Academic Year 2021-22

1.Initialize

2.Add

3.Commit

4.Pull

5.Push

 Some advanced Git operations are:


1.Branching
2.Merging
 The following diagram depict the all supported operations in GIT
Academic Year 2021-22

COMMANDS:
1. $git –version

2. $git config
The git config command is a convenience function that is used to set Git
configuration values on a global or local project level.

$git config –global


Global level configuration is user-specific, meaning it is applied to an
operating system user. Global configuration values are stored in a file that is
located in a user's home directory.
Academic Year 2021-22

3. $ git config --global --list

4. $git config --global user.name “<user_name>”


$git config –global user.email “<user_email>”

5. mkdir git-demo-project
cd git-demo-project

6. git init
git status
Academic Year 2021-22

7. git add new_git.txt


git commit -m “First Commit”

8. git log

9. git clone https://github.com/siddii/angular-timer.git


Academic Year 2021-22

10. git push origin master

11. git checkout -b feature

12. git commit -m “New Commit”

13. git push https://github.com/jaishrutimahadevan/git_test.git

14. git checkout master


Academic Year 2021-22

15. git merge


Academic Year 2021-22

EXERCISE 1:

1. Creating a new folder Jai_Git

2. Adding a new file “hello.txt” in to the folder Jai_Git

3. Contents of hello.txt

4. Initializing git
Academic Year 2021-22

5. Checking the status

6. Performing $git add .

7. Performing commit operation


Academic Year 2021-22

EXERCISE 2:

1. Creating a new branch “experiment1”

2. Making changes to “exp1.txt” in master branch

3. Committing the changes in master branch


Academic Year 2021-22

4. Changing to experiment1 branch

5. Updating “exp1.txt” in experiment1 branch

6. Committing the changes in experiment1 branch

7. Switching to master branch


Academic Year 2021-22

8. Encountered conflict on merging experiment1 branch

9. Snapshot of the file

10. Removing unnecessary sentences from “exp1.txt”

11. Committing changes


Academic Year 2021-22

12. Successful merging of experiment1 branch


Academic Year 2021-22

EXERCISE 3:
1. Remote repository on github

2. Pulling changes from the remote repository


Academic Year 2021-22

3. Making changes in the local repository by creating a new file “push.txt”

4. Adding the push.txt file and checking the status

5. Committing the changes

6. Pushing the changes into remote repository


Academic Year 2021-22

7. Updated remote repository

CONCLUSION:
In Exercise 1, we added a new file to the folder, checked the status and committed the
changes

In Exercise 2, we made changes to the file in master branch and performed commit operation.
A new branch “experiment1” was created and the same file has been updated and committed.
Merge operation was performed after switching to master branch

In Exercise 3, we performed pulling of a repository from remote repository. A new file was
added to the local repository, changes were committed and then pushed to remote repository.

Overall, we successfully learnt about version control systems, installed Git and performed basic
operations of Git. Git provides a way of keeping track of past versions of software and papers,
making collaboration between various authors easy, and provides backup for your software. It
has proven very useful to the open-source community and in academia as well. Git also has
several other commands that can be useful to perform lesser standard actions such as remove
sensitive data, clean up past history to save space, and so on. We have successfully understood
the purpose of using a version control for collaboration. Application and usage of GIT Push
and Pull commands was successfully executed.
Academic Year 2021-22

REFERENCES:

1. https://git-scm.com/
2. https://www.simplilearn.com/tutorials/git-tutorial/git-tutorial-for-
beginner#:~:text=Git%20is%20a%20DevOps%20tool,parts%20of%20the%
20same% 20program.
3. https://www.geeksforgeeks.org/git-lets-get-into-it/

You might also like