===============================================
To collaborate effectively with your friend on the same project, you should use Git branches to manage different lines of development. Here's a step-by-step procedure you can follow to streamline collaboration:
1. Create Separate Branches for Each Developer
Create a New Branch for Your Friend:
On your local repository, create a new branch for your friend. For example if your friend name is kilvish , if you want to create a branch named kilvish
, you would run:
make sure you would be on main branch already
command->
git checkout -b kilvish
git push origin kilvish
2. Set Up Your Friend’s Environment( On your Friend's System )
at kilvish side run ->
Clone the Repository (if not already done): If your friend hasn’t cloned the repository yet, they should do so:
command ->
Fetch All Branches: After cloning, your friend should fetch all branches:
3. Work on Your Branches
For You: Continue working on your branch (e.g.,
main
orfeature-yourname
) and push changes to GitHub as usual.For Your Friend: Your friend will work on kilvish and push changes to GitHub.
4. Handling Merges
Update Your Branch: Periodically, you and your friend should pull changes from the main branch (or whatever branch you are using as the base) into your feature branches to keep up-to-date. For example, if the base branch is
main
:
Now the following commands for the Main Guy who is Already working on main branch or owner of git repo ->
Summary of Commands
Here’s a concise summary of the commands you’ll use:
- Update local
main
branch
- Fetch latest branches and changes:
- Merge kilvish branch into
main
:
- Resolve conflicts (if any), add, and commit:
- Push the updated
main
branch:
Thank You .
Comments
Post a Comment