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

GitHub Manual

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

GitHub Manual

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Step by Step Guide to configure GitHub on vscode

Git:
 Git allows you to keep track of changes in your code over time, including who made the
changes and why.
 Git makes it easy to work on different features or fixes by creating separate branches,
then merging them back into the main project when ready.
 Git is typically used via the command line (CLI), though there are graphical interfaces
available.
Use Case:
You would use Git to manage versions of your code on your local machine, enabling you to:
 Track changes over time.
 Revert back to a previous state if something breaks.
 Collaborate with others without overwriting each other's work.
GitHub:
 GitHub is a web-based platform built on top of Git, providing a collaborative
environment for storing, sharing, and managing Git repositories in the cloud.
 Developers can explore public repositories, fork projects, and contribute to open-source
software.
Common GitHub Actions:
 Push to GitHub: You can push your local Git repository to GitHub, making it available
online.
 Pull Requests: Developers propose changes by creating pull requests, allowing team
members to review, discuss, and merge changes into the main branch.
 Forking: You can copy someone else's repository into your own GitHub account to make
changes or contribute.

1. First you need to make an account on GitHub.


https://github.com/

2. Click on SignUp button.


3. Enter your email and click on Continue button.

4. Enter password and click on Continue button.


5. Enter a username and uncheck email preferences.

6. Click on verify button.


7. Solve a puzzle.

8. Check Verification code on your email.


9. Now you enter email and password of your github account.

10. After Login you should click on some options which I already choosen.
11. Choose any two options and click on Continue button.

12. Click on continue for free option.


13. You see the interface which are given below.

14. Now create a new repository for test.

15. Enter the name of the repository and select private/public.


16. Your Repo is created see the picture below.

17. Setting Up Git.


https://git-scm.com/
Click on Download for Windows.
18. Click on Next Button.

19. Click on Override Option.


20. Open git and write git –version.

21. Open Vscode


Click on Sign in with GitHub to use GitHub Pull Requests.
22. After clicking on 'Sign in,' you will see the web page shown below. Then, click on
Authorize Visual Studio Code.

23. Now you can see the below your account is sign in with vscode.
24. Configure GitHub
Open Vscode Terminal and enter the following commands.
git config --global user.name “user-name”
In my case I replace user-name with “bilal-case”

git config --global user.email “valid-email”

git config --list

25. Create a folder named as GitHub Demo and open this folder on Vscode.
26. First you need to initialize a repo. Enter a command git init.
27. Write a simple C++ program to print Sir Syed Case Institute of Technology
Islamabad.

28. Enter command git status to display the state of the code.
29. Enter command git add . to add all the files.

30. Enter again git status.

31. Enter git commit -m “Add message”.

32. Enter git status.


33. Go to GitHub to create a new repo.

34. Enter git remote add origin <--link-->


git remote add origin https://github.com/bilal-case/local-repo.git

35. To verify remote repo. Enter git remote –v

36. Check branch.

37. If you want to rename the branch, enter git branch -M (branch name).
38. Now push the code on GitHub. Enter command git push -u origin (branch name).
-u means set upstream (if you want to work on a project for long time).
Click on Authorize git-ecosystem shown below.

The picture below shows that your code is pushed to the main branch.

39. After completing the previous steps, go to GitHub and refresh the page.
40. I want to create a new README.md file. Repeat steps 29 to 32.

git add .
git commit -m “add message”
git push
Summary:

Commands Use
git init Initializes a new Git repository in your
project folder.
git add [file-Name] Adds changes (new files or edits) to the
staging area, preparing them for a commit.
git commit -m "[message]" Saves your changes to the repository with a
message describing what you did.
git status Shows the current state of your working
directory, including changes and files not
yet committed.
git push Sends your committed changes to a remote
repository (like GitHub).
git branch Lists all the branches in your repository or
creates a new branch.

You might also like