Open In App

Advance Git Sheet For Open Source Contributors

Improve
Improve
Like Article
Like
Save
Share
Report

Github is significant in terms of open-source contributions at least you have to basic idea about git & GitHub. You are getting started with git and GitHub by visiting this article, Complete Guide on GitHub. This git cheat sheet is for all beginners to advance open-source contributors from basics. Github has a number of commands which helps you while contributing to open-source projects. This cheat sheet will guide step by step to git and introduce you to all commands you need to know as a developer.

Configure Git Environment

To set up a git environment you have to first download it, you can download it from git official.

git config --global user.name "your git username"
git config --global user.email "githubemail.com"

after setting up your GitHub configurations is time to make open-source contributions!

Git for Open Source Contributors

To get starting with first opensource contributions first you have to find a project to contribute to. There are various open-source beginner-friendly projects available search for them and get settled with any one of them. Follow the below steps to make your first open source contribution.

Step 1: Fork the project from the right corner icon. We fork project for making it available on our local machine and we can test and add new features to it.

 

Step 2: Clone the project to your local machine. The cloning project is simple and it set up the project on our local machine.

 

Step 3: Set up upstream for the project. Upstream helps you to keep track of the difference between the clone project and the original repository. Open a pull request.

 

Step 4: Create the branch for an open-source project to contribute. Creating a branch is like working on the idea we want to implement or the bug we want to solve for the project.

git checkout -b <your branch name>

Step 5: Commit contributions

Committing your contributions is important and easy. It keeps track of your contributions and code which you add to the branch and while making a commit try to give a specific message because next time you can directly work on previous code as well.

git add .
git commit -m 'Commit message'

Step 6: Pull from upstream to the branch.

git pull upstream <branch name>

Step 7: Push on your working branch.

git push origin <branch-name>

Step 8: Open a pull request. After adding changes to the project create a pull request to compare with the original repository.

 

After creating your first pull request successfully the next step is to explain the changes you did, The dialogue box will open and you have to explain specific details about the changes.

Advance git commands

Git Status:

To check your git repository status we use this command

git status

To see your commit history in Git:

git log

To see your commit history including changes in Git:

git log -p

To see a specific commit in Git:

you need to commit the id for this command

git show commit-id

To remove tracked files from the current working tree:

git rm filename

To rename files on Git:

git mv oldfile newfile

Ignore git files:

Create a .gitignore file and commit it.

Conclusion

We listed the all necessary commands you need as an open-source contributor and there are also other commands which are available you can explore or once you start with contributions you will automatically get an idea about it. There are a number of beginner-friendly open-source projects are available on GitHub to explore and start contributing to opensource.


Last Updated : 31 Aug, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads