Affiliated to VTU, Belagavi| Approved by AICTE, New Delhi |NAAC A+ & NBA Accredited|
NIRF Innovation Ranked, UGC 2(f), ISO Certified| Recognized by Govt. of Karnataka
REPORT
Topic: UNIX ASSIGNMENT
Subject: Unix with git(23CS209) Faculty: Prof. Tejaswini Done by: Vishvas G V– 1CD23IS190 - What is a Git Repository? A Git repository is a storage space where all the files for a project are stored along with their version history. Git keeps track of the changes made to the files over time, allowing you to view past versions, roll back changes, and collaborate with others. There are two types of Git repositories: 1.Local Repository: This is on your local machine, and it stores all the project's history and files. 2. Remote Repository: A repository hosted on a server or a cloud platform (e.g., GitHub, GitLab) which is used to share the project with others - Creating a Local Git Repository: -
Step 1: Initialize the Repository: Run the following command to turn
your project folder into a Git repository: git init This creates a hidden .git directory and sets up the repository to track changes. – Step 2: Add Files to the Staging Area: Once you make changes to files or add new files, you need to stage them before committing. Run: git add Or to add all files in the directory: git add . The staging area allows you to carefully select the changes that will be included in the next commit. – Step 3: Commit the Changes: To save your changes, commit them to the local repository: git commit -m "Initial commit" The -m option allows you to add a message that describes the changes in the commit. This message should be brief but descriptive of the changes made. - What is Branching?
Branching in Git allows you to diverge from the main line of
development (usually the main or master branch) to work on different tasks or features without affecting the main project. This helps in parallel development and testing of new features or bug fixes. - Create a Branch:
To create a new branch: git branch
To switch from one branch to another: git checkout You can also use the new git switch command for switching branches: git switch - List All Branches: To list all the branches in your repository: git branch
– Delete a Branch: Once a branch is no longer needed, it can be