Do you want to work on a project but don’t know how to use git? Well surprisingly, to get or make changes to a remote repository, you don’t need git anymore! With the help of GitHub Desktop and Visual Studio Code (popularly known as VS Code) you can do this in no code. So without any further ado, lets see how you can use these amazing tools for you next project.
1. Make new repository (optional)
This step is optional if you already have a repository or are going to work on another user’s repository. But if you are just starting a new project, you can either use GitHub Desktop, VS Code or, follow the following directions:
To make a new repository on GitHub: In the upper-right corner of any page, use the drop-down menu, and select ‘New repository’.
2. Clone the repository
With the help of GitHub Desktop, you can get a complete copy of the repository i.e. you can clone the repository.
To clone a repository: Open GitHub Desktop -> in the upper-left corner, Current repository->From the ‘Add’ drop-down menu, Choose ‘Clone repository’… ->Search your repository name->Select->‘Clone’.
Note: If you are to clone another user’s repository, you would first have to fork it. You can do that directly from GitHub.
3. Add your code using VS Code
Now its time to make the changes.
To make the changes in code, open it in VS Code. To do so: Choose ‘Open code in Visual Studio Code’.
Open VS Code and open the repository you just cloned: File -> Open Folder -> Select local copy of repository.
Every time you modify code, it is highlighted in VS Code until it isn’t committed.
4. Commit and push your changes
Option 1: GitHub Desktop
1. Select the files you want to commit.
The changes you have made in the files are reflected on RHS.
2. Add ‘Summary’ and ‘Description’.
4. ‘Push Origin’ to push the changes to the remote repository.
Option 2: VS Code
Here is a GIF of the steps you can follow to commit and push the changes from VS Code.
Note: You can also discard the changes you made if don’t want to keep them, simply ‘Discard changes’ to do so.
5. Fetch changes from a remote repository
Use GitHub Desktop, to retrieve new work done by other people.
1. ‘Fetch origin’ from the upper-center button to check for changes.
2. If there are any new changes to merge, GitHub Desktop will show an option to pull origin.
‘Pull origin’ to get these changes on your computer.
Kudos! Now, you know how to fetch and push code with the help of GitHub Desktop and VS Code, and it required no code at all. You can get busy making amazing projects on GitHub quickly!
If you liked this article, please hit the clap button, leave a comment and follow my account.