0% found this document useful (0 votes)
11 views12 pages

Report Git Final

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)
11 views12 pages

Report Git Final

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/ 12

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

“JNANA SANGAMA”, BELAGAVI – 590018

Lab Record
On

GitHub: AI-Powered Developer Platform


Submitted by

Name: Shrajan R Shettigar USN:4SF21CD028


In partial fulfillment of the requirements for V Semester of

BACHELOR OF ENGINEERING
IN
Computer Science & Engineering (Data Science)

Under the Guidance of


Mrs. Masooda
Assistant Professor
Department of Information Science & Engineering
at

SAHYADRI
College of Engineering & Management
An Autonomous Institution
Mangaluru – 575 007
2023-2024
1. Initialize a new Git repository in a directory. Create a new file and add it to the staging area
and commit the changes with an appropriate commit message.

• Create a new git repository in your account.


• Copy the repository url.
• Open VS code and clone a folder to git repository using the command
“git clone <repository_url>”

• Change the directly using the command


“cd <repository_name>”

• Create a text file called abc.txt.


• Add the text file using the command
“git add abc.txt”

• Commit the text file using a commit message using the command git commit -m
“first commit”

• Push the text file into your git repository using the command
“git push origin main”

• To create a pull request first create a file in github called pqr.txt


• Now execute pull request in VS code terminal using the command
“git pull origin”

• pqr.txt file will appear in VS code.


2. a. Create a new branch named "feature-branch." Switch to the "master" branch. Merge the
"feature-branch" into "master."
b. Write the command to stash your changes, switch branches & apply the stashed
changes.
• Create a new git repository in your account.
• Copy the repository url.
• Open VS code and clone a folder to git repository using the command
“ git clone <repository_url>”

• Change the directly using the command “cd <repository_name>”


• Use the command “git branch” to check the current branch.
• Create a new branch using command
“ git branch -c feature-branch”

• To switch from main branch to feature-branch use command


“git checkout feature-branch”

• To push the feature branch to repository use the command


“git push origin feature-branch”

• Create another branch in github called second-branch.


• To switch from current branch to second-branch use “git fetch origin” then use
“git checkout second-branch”.

• Use “git stash” to stash all the changes


3. a. Clone a remote Git repository to your local machine.
b. Fetch the latest changes from a remote repository and rebase your local branch onto
the updated remote branch.
c. Write the command to merge "feature-branch" into "master" while providing a
custom commit message for the merge. 
• Create a new git repository in your account.
• Copy the repository url.
• Open VS code and clone a folder to git repository using the command
“ git clone <repository_url>”

• Change the directly using the command “cd <repository_name>”


• Create a new branch using command
“ git branch -c feature-branch”

• To push the feature branch to repository use the command


“git push origin feature-branch”

• Create one text files in each of the branches.


• To fetch the latest changes use command
“git fetch”

• To rebase your local branch onto the updated remote branch use command
“git rebase origin/feature-branch”

• “git pull origin main”


• “git push origin main”
• To merge "feature-branch" into "master" use command
“git merge feature-branch -m “merge” ”
4. Write the command to create a lightweight Git tag named "v1.0" for a commit in your local
repository.
• Create a new git repository in your account.
• Copy the repository url.
• Open VS code and clone a folder to git repository using the command
“ git clone <repository_url>”

• Change the directly using the command “cd <repository_name>”


• Create a file called a.txt and add the file with “git add a.txt”

• Commit the text file using a commit message using the command git commit -m
“first commit”
• Push the text file into your git repository using the command
“git push origin main”

• Create another file b.txt


• Add the text file using the command
“git add b.txt”

• Commit the text file using a commit message using the command git commit -m
“Second commit”

• Push the text file into your git repository using the command
“git push origin main”

• Now create tag using command


“git tag v1.0”

• To display the tag use command


“git tag”

• Push the tag using command


“git push origin v1.0”

• Create a file called lmn.txt and add the file with


“git add a.txt”

• Commit the text file using a commit message using the command git commit -m
“third commit”

• Push the text file into your git repository using the command
“git push origin main”
• To creates a branch Version1 with v1.0 tag use command
“git checkout -b Version1 v1.0”

• Push the changes using the command


“git push origin Version1”
5. Write the command to cherry-pick a range of commits from "source-branch" to the current
branch.
• Create a new git repository in your account.
• Copy the repository url.
• Open VS code and clone a folder to git repository using the command
“git clone <repository_url>”

• Change the directly using the command


“cd <repository_name>”

• Create a text file called abc.txt.


• Add the text file using the command
“git add abc.txt”

• Commit the text file using a commit message using the command git commit -m
“first commit”

• Push the text file into your git repository using the command
“git push origin main”

• To create and switch to new branch use command


“git checkout -b source-branch”

• Check the branch using the command “git branch”


• Create two new files say b.txt and c.txt and push them to the feature branch.
• Now switch to main branch using the command
“git checkout main”

• To cherrypick the commits from source-branch to main branch use the command
“git cherry-pick second branch~2..source-branch”

• “git add ”
• Push the changes in the source branch using the command
“git push origin source-branch”

• Push the changes in the main using the command


“git push origin main”
6. a. Given a commit ID, how would you use Git to view the details of that specific commit,
including the author, date, and commit message?
b. Write the command to list all commits made by the author "JohnDoe" between
"2024- 01-01" & "2024-12-31.
c. Write the command to display the last five commits in the repository's history.
d. Write the command to undo the changes introduced by the commit with the ID
"abc123".
• Create a new git repository in your account.
• Copy the repository url.
• Open VS code and clone a folder to git repository using the command
“git clone <repository_url>”

• Change the directly using the command


“cd <repository_name>”

• Create a text file called f1.txt.


• Add the text file using the command
“git add f2.txt”

• Commit the text file using a commit message using the command git
commit -m “first commit”

• Push the text file into your git repository using the command
“git push ”

• Create 4 more files f2.txt ,f3.txt ,f4.txt ,f5.txt and repeat the same steps.
• Use command “git log” to find your commit id.
• To view the details of that specific commit,including the author, date, and commit
message use the command “git show <commit_id>”

• To list all commits made between "2024- 01-01" & "2024-12-31 use the
command
“git log --author="Apoorva-Kamat" --since="2024-01-01" --until="2024-12-31" ”

• To display the last five commits in the repository's history use command
“git log -n 5”

• To undo the changes use the command


“git revert <commit_id> -n

You might also like