This guide will help you navigate GitHub with ease.
-
Start by downloading and installing the GitHub Desktop app.
-
Sign in using your GitHub account.
-
Pick the repository you'd like to work on.
-
Choose a local folder where you'll store the project.
-
Click 'Clone' to download the project to your local folder.
-
Make any changes you want to the project.
-
Open the GitHub Desktop app to see the changes you've made.
-
To save your changes or commit the history, go to the bottom left of the screen, give your change history a title, and click on
commit to main
. -
Once you've committed, your changed file will no longer appear in the left menu.
-
Click
Push origin
to upload your changes to GitHub.
-
Sign in to your GitHub account on your preferred web browser.
-
Click on the
+
button at the top right of the screen and selectNew repository
. -
Give your repository a name and, if you want, add a description.
-
Make sure the repository is set to
Public
. -
Click on
add a README file
and thenCreate repository
.
-
Copy the URL of the new repository you want to switch to.
-
Open the repository you want to change from in VS Code and open the terminal.
-
Type
git remote set-url origin <new repository url>
and press enter. -
Add, commit, and push the changes to the new repository using the VS Code UI.
-
Green vertical lines next to line numbers show incoming updates to the repository.
-
Blue vertical lines next to line numbers show outgoing updates to the repository. Click on the blue line to see the changes you've made.
-
Green = data added to the repository
-
Red = data deleted from the repository
-
Orange = modified data in the repository
-
In GitHub Desktop, you'll see the history tab to the right of the
Changes
tab. Click on it to see the repository's history. -
To undo changes, right-click on any history you want to revert and click on
Revert changes in commit
. -
If your changes affect or are about to overwrite the current content in your project, a prompt to resolve conflicts will appear.
-
Switch to VS Code to resolve the conflict. Files marked as conflicted will have
>>>>>>
and<<<<<<
in the file and will be colored in red or orange. -
Click on the conflicted file and click on
Resolve in Merge Editor
. The incoming changes will be on the left side and the outgoing changes will be on the right side. -
Click
Accept Incoming Change
to accept the incoming changes,Accept Current Change
to accept the outgoing changes, orAccept Both Changes
to accept both. -
Click
Complete Merge
to finish the merge.
Branching lets you work on different versions of a repository at the same time. By default, your repository has one branch named main
, which is considered the definitive branch. We use branches to experiment and make edits before committing them to main
.
-
To create a new branch, click on the
Current Branch
button at the top left of the screen and click onNew Branch
. -
Give your branch a name and click
Create Branch
. -
Any changes you make on the new branch won't affect the
main
branch. -
To merge the branch into the
main
branch, click on theCurrent Branch
button at the top left of the screen and click on themain
branch. -
Click on
Choose a branch to merge into main
. -
Click on the branch you want to merge and click
Create a merge commit
.