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

Task 1: Bash Here. You Will See This Screen

1. The document provides instructions for using Git and GitHub. It covers downloading and installing Git, initializing a Git repository, staging and committing files, pushing a repository to GitHub, creating and merging branches, and using the GitHub Desktop GUI. 2. Specific tasks include creating an initial Git repository with sample files, making commits on the master branch, adding a remote to push the repository to GitHub, creating and committing to a new branch, and merging the branch back into master. 3. The final task demonstrates using the GitHub Desktop application to interact with a repository by adding and committing files, and performing actions like push, pull, and merge through the GUI.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Task 1: Bash Here. You Will See This Screen

1. The document provides instructions for using Git and GitHub. It covers downloading and installing Git, initializing a Git repository, staging and committing files, pushing a repository to GitHub, creating and merging branches, and using the GitHub Desktop GUI. 2. Specific tasks include creating an initial Git repository with sample files, making commits on the master branch, adding a remote to push the repository to GitHub, creating and committing to a new branch, and merging the branch back into master. 3. The final task demonstrates using the GitHub Desktop application to interact with a repository by adding and committing files, and performing actions like push, pull, and merge through the GUI.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Task 1

1. Download Git from here https://git-scm.com/ (Version 2.26.2)


2. Install Git (Installation Guide: https://www.youtube.com/watch?v=SWYqp7iY_Tc)
3. Create a Folder in Desktop with name “L3” and Right Click on folder L3 and Select Git
Bash Here. You will see this screen

4. Check git version


• git --version
5. Now add files with this Command:
• touch index.html
• touch about.html
• touch resources.txt

6. Check your Folder, you will see these files

7. Open your file index.html in notepad or notepad++. Add these lines of code & save
<html>
<head>
<title> My Title </title>
</head>
<body>
My First Page
</body>
</html>
8. Open resources.txt and Write your name and Save this file
9. Initialize a Git repository/working directory
• git init

• Check your Folder, you will see .git folder. And within this folder you will find
Git Related Folders and files.

10. Configure user name and email


• git config - - global user.name ‘Your Name’
• git config - - global user.email ‘[email protected]
11. Check Status of Working directory
• git status
12. Add file or files
• git add index.html
• git add .
13. Check Status of Working directory
• git status

14. Commit chages in your working directory


• git commit

• Press ‘i’ to enable insert mode & type some text like Initial Commit or
any text
• To Exit - Press ‘Esc’ Key and type ‘:wq’

15. After all commit, Check Status of Working directory (This will show you message like
nothing to commit, working tree clean)
• git status
16. Make changes to resources.txt. Add few names of your friends
17. Check with git status, it will show (changes not staged for commit)
• git status
18. Add file or files
• git add .
19. Commit chages in your working directory with commit message
• git commit -m ‘Changed resouces.txt’
20. Check with git status, it will show (changes not staged for commit)
• git status

21. View commit history


• git log

Task 2 – Git & Github


1. Create an account on Github.com
2. Use Git Bash and Follow these commands:
• git remote
• git remote add origin https://github.com/youraccountname/reponame.git

Ex - git remote add origin https://github.com/amaharjantbc/L3Sample.git


• git remote
• git push -u origin master

- Enter your github username/email and password


- Then in github.com, reload your repository page & see your added files
3. Clone Github Repository
• git clone https://github.com/youraccountname/reponame.git

*Note: If you would like to set another url or correct one.


git remote set-url origin https://github.com/amaharjantbc/L3.git
Task 3 – Branch & Merge
1. Check the branches first
• git branch
2. Create a new branch
• git branch <new-branch-name>
-ex: git branch branch1
2. Check out new branch (This will switch to new branch)
• git branch <new-branch-name>
-ex: git branch branch1
Or you can simple combine above 2 steps with this single command:
• git checkout -b <new branch-name>

3. Now add files with this Command on New Branch & add some lines of code & save.
• touch b1.html
4. Add this new file
• git add .
5. Commit changes with commit message
• git commit -m ‘Added New File b1.html’
6. Push the new branch on github
• git push origin <new-branch-name>
-ex: git push origin branch1
7. Check on your github, you will now see 2 branches

8. On your github, check master and branch1. And find what is the difference with file
count
9. For Merging your changes on New Branch to Master: follow these steps:
• Git checkout master
• Git merge <new-branch-name>
-ex: git merge branch1
• git push origin master
10. Check in your github for Master, you will find the new file you have added as b1.html

Task 4 – GUI
1. Download github desktop from https://desktop.github.com/
2. Run and login with your github credentials
3. Create a new repository (either on github.com or using github desktop)
Or
Select the repositories you have in your github
4. Add Some Files
5. Show your effort on following:
• Commit
• Push
• Pull
• Merge

You might also like