0% found this document useful (0 votes)
14 views1 page

Git and Github

Uploaded by

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

Git and Github

Uploaded by

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

Name: Rakesh Sivan S

Ref no.: 24900385


Dept: ECE first year

[Link] create a new directory named git-workshop and navigate into it, you can use
these commands in the terminal:
mkdir git-workshop -->Creates a new directory named 'git-workshop'
cd git-workshop -->to navigate into the 'git-workshop' directory

[Link] initialize a Git repository in your current directory:


git init

[Link] can create a new file named [Link] and add the content "Hello Git
workshop!":
echo "Hello!" > [Link]

[Link] display the status of your Git repository:


git status

5.i)To stage the file [Link]:


git add [Link]

ii)To commit the staged file with the message "Add [Link] with welcome
message":
git commit -m "Add [Link] with welcome message"

6.i)To create a new branch named update-content:


git branch update-content

ii)To switch to the update-content branch:


git checkout update-content

7.i)To append the text "This is a simple Git assignment." to [Link]:


echo "This is a simple Git assignment." >> [Link]
ii)To stage and commit the changes to [Link] with the message "Update
[Link] with additional message:
git commit -m "Update [Link] with additional message"

8.i)To switch back to the main branch:


git switch main
ii)To merge the update-content branch into the main branch:
git merge update-content

[Link] show the commit history of your Git repository:


git log

10.i)If you want to revert changes made to [Link] before committing :


git restore [Link]
ii)to reset your branch to a previous commit:
git reset --soft <commit_hash>

11.i)to command adds a remote repository named `origin`:


git remote add origin [Link]
ii)To push your local main branch to the remote repository:
git push

You might also like