0% found this document useful (0 votes)
16 views

Day 4 Assignment

Uploaded by

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

Day 4 Assignment

Uploaded by

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

Day 4 Assignment

Name: Mehul Anjikhane Email:[email protected]

Assignment 1: Initialize a new Git repository in a directory of your choice.


Add a simple text file to the repository and make the first commit.

Ans:
1. Choose the directory
Open your terminal and navigate to that directory.

2. Initialize the repository


Use the “.git init” command in your terminal. This creates a hidden folder
called .git which stores the version control information.

3. Create and add a text file


Create a new text file using your preferred text editor (e.g. Simple.txt). Add
some content to the file (e.g., "This is my first commit").

4. Stage the file for commit


Use the “git add .” command.It will add files/folders from current folder to the
cache / local git repository / stage.This action is known as staging.

5. Check status of file


Use the “git status” command to check status of added files or to check which
set of files staged/added and which set of files unstaged/not added.

6. Commit the changes


Use the “git commit -m "any commit related message"” command to create a
snapshot of the current state of your files. Include a descriptive message to
explain what changes you made.
7. Finally we pushed our file in remote repository:

Assignment 2: Branch Creation and Switching.Create a new branch


named 'feature' and switch to it. Make changes in the 'feature' branch and
commit them.

Ans:
1. Create and Switch to the new branch:
Use the “git branch Feature” command to create branch.
Then use “git checkout feature”command. This command switches you to a
different branch.

2. Make changes in the 'feature' branch:


Edit your existing file (e.g., test.txt) or create a new file specific to the feature you're
working on.

3. Stage and Commit the changes:


Use “git add .” command.It will add files/folders from current folder to the
cache / local git repository / stage.
And then use “git commit -m "Your commit message here" command.

You might also like