Collaborate with Peers on GitHub
Nitin Reddy

Nitin Reddy @nitinreddy3

About: Seasoned JavaScript Developer who loves to explore other programming languages like Python. A problem solver, tech lover by heart. Loves reading booking, and cooking. 🤩🚀🔬

Location:
Pune, India
Joined:
Nov 21, 2018

Collaborate with Peers on GitHub

Publish Date: Apr 14 '22
5 0

If you are working in an organisation where GitHub is used as a source code hosting site, then this post will be a helpful one for you.

Nowadays, as devs, we are following some of the best practices like forking the repository from the main organisation's account, and we come across a situation wherein you want to collaborate with your peer on a feature and you decide to push the code on the same branch.

Github collaboration

Some of the commands that would work on the peer's forked repository (Can be followed in this order) :-

git remote add theirUsername https://github.com/theirUsername/repoName
Enter fullscreen mode Exit fullscreen mode
git fetch theirUsername
Enter fullscreen mode Exit fullscreen mode
git checkout -b myLocalBranch theirUsername/theirBranch
Enter fullscreen mode Exit fullscreen mode
git add/commit the changes
Enter fullscreen mode Exit fullscreen mode
git push https://github.com/theirUsername/repoName HEAD:branchName
Enter fullscreen mode Exit fullscreen mode
git pull https://github.com/theirUsername/repoName branchName
Enter fullscreen mode Exit fullscreen mode

Hope this post will help you in better collaboration in a long run.
Happy learning !!

Comments 0 total

    Add comment