top of page
Writer's pictureRenuka Hari

How to Use GitHub Desktop for your Project

GitHub Desktop has a graphical user interface that simplifies commands and helps you visualize the changes on the files and branches.


Why we need GitHub for our project


For collaborating on projects where we have to work with a team, we need a remote repository. This is where we need GitHub. It helps us to keep tracks of the code and the changes made on the code. We can create multiple branches for the team and merge the code for the project. It helps us to perform the code reviews and add the review comments.


Lets check on how to work with Git, Github and GitHub Desktop in this blog.


Creating an account:

 

To start with GitHub, you need to create a free personal account on GitHub.com and verify your email address.

Create an account on GitHub.com with your email, password and username for your GitHub repository. Login in and create a new repository.


GitHub Desktop


Download and install GitHub Desktop using the below link as per your system configuration.


Next to use GitHub Desktop, you must have Git installed. Download git using the below link as per your system configuration.



This is the first screen you will view after installation.












Step 1: Create a new branch










Step 2: In the right-side panel, you can see the Edit a file, open the editor and edit the ReadMe.md file and commit the changes with appropriate comments.




Step 3: Publish this branch with the file to GitHub.



Step 4: Open a pull request.














Step 5: This will redirect you to the GitHub repository pull request page.



Step 6: After creating pull request, merge pull request.











Step 7: Confirm the Merge with comment.











Step 8: Your file with be merged with the main branch, click on main and you can see the Readme file in the main.













Step 9: Click on the main branch and you can see your branch.













Working with a new file:


Once you have created the file, you can either add it to a local repository or clone it to GitHub repository from the GitHub Desktop.









Add Local Repository:

You can specify a location for your local repository and create the repository.

 

Clone Repository:

Let’s see how to clone the repository.

  1. Sign in the GitHub repository and GitHub desktop.

  2. In GitHub.com navigate to main page of repository. Click on the <>Code on the right side of the page.










3. To clone, click Open with GitHub Desktop. Navigate to local directory where you want to clone the repository and click Clone.












4. The changes in GitHub repository will be cloned now to your GitHub Desktop.



Committing a file from local to GitHub:

When you want your changes on your local system to get updated on the Github repository, commit the changes and create a pull request as below.


Step 1. Create a new file in the GitHub location of your local system.

Step 2. Open GitHub desktop, click your branch you wanted to update the file.

Step 3. Commit the changes.





Step 4. Push Origin will be enabled with the changes you have made to the branch. Click on Push Origin.

Step 5. Open GitHub repository and click on compare & pull request.















Step 6. Add a title and create pull request.




Step 7. Click on Merge pull request. If there are no merge conflicts, click on Confirm Merge.

Step 8. Your code has been merged to the main branch successfully.



Syncing your branch from the GitHub Desktop


You can sync your local branch with the remote main repository by pulling the commits. This is necessary when you are working on a project and multiple people are contributing on it. You need to do sync to keep the branch updated.








Click on Fetch Origin to bring the changes from the remote main repository to your local system.

Step 1. Delete a file from the main branch in remote repository.

Step 2. Click on Commit changes.













Step 3. Click on Commit changes.

Step 4. Open GitHub desktop, Click on Fetch Origin






Step 5. You can view there are 2 files changed from the remote repository. Click on Pull origin and the changes will be reflected in your local repository.


Hope this information helps in your project.

94 views

Recent Posts

See All
bottom of page