0% found this document useful (0 votes)
4 views14 pages

Git1 1

The document outlines the curriculum for a Source Code Management course, detailing practical tasks related to Git and GitHub, including installation, configuration, collaboration, merging branches, and push/pull operations. Each practical task includes theoretical background and step-by-step procedures for effective source code management. The document serves as a guide for students to learn and apply version control techniques in software development.

Uploaded by

sagarsharma82995
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views14 pages

Git1 1

The document outlines the curriculum for a Source Code Management course, detailing practical tasks related to Git and GitHub, including installation, configuration, collaboration, merging branches, and push/pull operations. Each practical task includes theoretical background and step-by-step procedures for effective source code management. The document serves as a guide for students to learn and apply version control techniques in software development.

Uploaded by

sagarsharma82995
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Subject Name: Source Code Management

Subject Code: 24CSE0106

Cluster: i-Alpha

Department: DCSE

Submitted By: Submitted To:


Name: Aniket Sharma
Roll no. 2410990920 Dr. Arjun Puri
G12 Department of Computer Science
& Engineering
Chitkara University Institute of
Engineering and Technology Rajpura,
# Index Task 1.1#

S. Program Title Page No.


No

1. To install and configure Git Client on your local system 01

2. Setting up GitHub Account and Adding Collaborators on GitHub 21


Repository

To merge two branches within a Git repository.


3. 24

4. To demonstrate push and pull operations in Git. 27


Practical No.:1

Aim: To install and configure Git Client on your local system


Theory:
Git is a distributed version control system that allows developers to track changes,
collaborate, and manage source code efficiently. To use Git on a local system, the Git
client must be installed and properly configured. The Git client provides command-
line tools and graphical interfaces to interact with repositories, commit changes, and
sync with remote repositories like GitHub.

After installation, configuring Git with user credentials ensures proper identification
when making commits. Additionally, setting up SSH keys or HTTPS authentication
allows secure interaction with remote repositories.

Proper configuration of Git helps in maintaining version control, improving team


collaboration, and enabling smooth development workflows.

Procedure:
1. Download Git Client:

o Visit the official Git website and download the latest version suitable for your
operating system (Windows, macOS, or Linux).

2. Install Git:

o Run the downloaded installer and follow the installation wizard, selecting the
recommended settings.

3. Verify Installation:

o Open a terminal or command prompt and run the following command to check if
Git is installed successfully:
4. Configure Git User Information:

Set up your name and email to associate commits with your identity:

5. Check Git Configuration:

• To verify the configured settings, use:


Practical No. : 2

Aim: Setting up GitHub Account and Adding Collaborators on GitHub


Repository

Theory:
Whenever you make a repository in GitHub, not everyone has the permission to
change or push codes into your repository. The users have a read-only access. In
order to allow other individuals to make changes to your repository, you need to
invite them to collaborate to the project.

GitHub also restricts the number of collaborators we can invite within a period
of 24 hours. If we exceed the limit, then either we have to wait for 24-hours or
we can also create an organization to collaborate with more people.

Being a collaborator, the user can create, merge and close pull requests in the
repository. They can also remove them as the collaborator.

Procedure:

1. Login to your GitHub account and you will land on the

homepage as shown below. Click on Repositories option in

the menu bar.


2. Click on the ‘New’ button in the top right corner.

3. Enter the Repository name and add the


description of the repository.
4. Select if you want the repository to be public or private.
5. If you want to import code from an existing
repository select the import code option.

6. Now, you have created your repository successfully.

7. To add collaborators to your repository, open your

repository and select settings option in the navigation bar.


8. Click on Collaborators option under the access tab.

9. To add members, click on the add people option


and search the id of your respective team member.
11.To remove any member, click on remove option
available in the last column of member’s respective row.
Practical No.:3
Aim: To merge two branches withing a git repository
Theory:
In Git, merging is the process of combining the changes from one branch into
another. This is essential for collaborative development, as it integrates new features,
bug fixes, or updates into the main project.

There are two types of merges:


1.Fast-Forward Merge: If there are no divergent changes, Git simply moves the

branch pointer forward.

2.Three-Way Merge: If both branches have unique commits, Git creates a new

commit to combine them.

Merging ensures that different development efforts are synchronized, preventing


conflicts and maintaining a unified codebase.

Procedure:
1. Check Existing Branches:

o List all branches in the repository:

2. Switch to the Target Branch (e.g., master or main):

Before merging, ensure you are on the branch where you want to integrate changes

Or
3. Merge the Other Branch (e.g., feature-branch):

Use the following command to merge feature-branch into master

4. Resolve Merge Conflicts (if any):

If conflicts arise, Git will notify you. Open the conflicting files, resolve the issues, and
mark them as resolved:

5. Verify the Merge:

Check the commit history to confirm the merge:

6. Push the Merged Changes (if working with a remote repository):

Update the remote repository with the merged branch:


Practical no.:4
Aim: To install and configure Git Client on your local system
Theory:
Git allows developers to synchronize their local repository with a remote

repository using push and pull operations. These operations help in

collaboration by ensuring that all contributors have access to the latest code

changes.

• Git Push:

o The git push command uploads local commits to the remote repository.

o It updates the remote branch with changes from the local branch.

o Commonly used when contributing to shared repositories.

• Git Pull:

o The git pull command fetches and merges changes from the remote repository
into the local branch.

o It ensures that the local repository is up-to-date with the latest remote changes.

These operations prevent version conflicts and help maintain a consistent workflow in

collaborative projects.

Procedure:
Pushing Changes to a Remote Repository

1. Check the Remote Repository:

Ensure that the remote repository is configured:


2. Ensure the Local Repository is Up-to-Date:

Fetch the latest changes before pushing:

Push Local Changes to Remote:

• Add and commit the changes:

• Push the committed changes to the remote repository:

Pulling Changes from a Remote Repository

1. Check the Remote Repository for Updates:

Ensure you are on the correct branch:


2. Pull the Latest Changes:

o Fetch and merge updates from the remote repository:

3. Resolve Merge Conflicts (if any):

o If conflicts occur, manually resolve them in the affected files.

o Mark them as resolved and commit the changes:

You might also like