top of page
Writer's pictureprajakta k

GITHUB DESKTOP - Fundamentals


 

GitHub Desktop is a seamless way to contribute to projects on GitHub and GitHub Enterprise. It is a valuable tool for both beginners and advanced users. It is a free, open-source application that helps you to work on code hosted on GitHub or other Git services. GitHub can be used for performing Git commands such as commit, push or pull. It is a great alternative for command line.


Many developers find GitHub somewhat overwhelming and intimidating when they start using it. It appears to be difficult than it actually is. If you are new to GitHub this blog can definitely be an icebreaker for you.  All you have to do is just follow along…..


Managing projects with GitHub desktop:

Download GitHub Desktop on your machine from the GitHub.com. Once done open the Homepage there you see 3 options:

1)     Create a New Repository - This creates a new repository on your hard drive

2)     Add an existing repository from your hard drive- You can add an already existing repository from your hard drive to your GitHub account.

3)     Clone a repository from the internet- This allows you to clone (Copy) a repository from your GitHub account.

All the above options can be found in the File Menu as well:

Click on create a New repository:

Fill in the details as above. Then click on Create Repository.

Now on the Desktop homepage you can see the Current Repository as the NewRepo. Current branch is the Main branch. You can then publish this repository on GitHub by clicking Publish Repository. After filling in the details once again, select GitHub.com option on the top and keep the check box checked if you want the code to be private, then click on publish. You can now view your Repository on GitHub by clicking on View on GitHub option.

 

Push, Pull and Merge operations:

Pull- The Pull operation fetches the changes made to the remote branch into your local branch. This helps to keep your local work up-to-date with other collaborators’ changes. This operation should essentially be performed before the Push operation.

Push- The Push operation refers to sending committed changes to your project from a local repository to a remote repository so that your teammates can have access to these changes. This helps to avoid any merge conflicts.

Merge- This operation allows you to integrate changes from one branch into another branch.

 

How to create a branch?

You can create a new branch in your repository to safely work on any changes in your code or project. Creating a branch can help you to develop a new feature or fix a bug. Creating branches from earlier commits can also help you return to your previous versions of code.

To create a branch, click on main branch tab, then click on New Branch. Give a suitable name to your branch and click on New Branch. The newly created branch can then be published to open a pull request and collaborate with others.

You can now add a file to your repository from GitHub.com, in your web browser. You can add a file in FirstBranch or directly in your Main branch. For this click on the Add file option and create a new file or upload an existing one. I am trying to upload a Jupyter Notebook file named Python Basics in FirstBranch. Before clicking on “Commit changes” add all the details.


 Now your sub branch is having 1 commit ahead of main branch. To equalize both GitHub will ask you to Compare changes and create a Pull Request from FirstBranch. The pull request pop’s-up evrytime you make changes to your repository from any of your branches.

Now you can click on Compare & Pull Request to create a request for other branches to pull before they make any changes to the shared file. Since the changes or commits made to the current branch does not exist on your machine, you need to “Pull Origin” from GitHub Desktop.

When the current branch has no conflicts with the base branch, merging can be performed safely. From the browser to merge the files click on the button “Merge Pull Request”. This ensures that the Pull request was successfully merged and closed.

 

 

So, to conclude these were some of the basics to get you started on your GitHub journey. The examples showcased in this post illustrate the versatility and power of using GitHub for collaborative development. Hope this encourages you to explore further and to share your work thus contributing to the GitHub community. Keep learning!

 

 

 

 

 

 

 

22 views

Recent Posts

See All
bottom of page