One of the most essential tool you will definitely work with as a developer is GitHub.
Because there's so much interesting stuff GitHub provides to us,
today I'll explain to you how it looks like to working with a team on a project on GitHub, I'll tell you what you can do because i was in your shoes before and struggled to understand what should i do exactly.
I assume that you know what is Git and GitHub because today i won't explain them, I'll be more focused on how to use it with your team.
Great, let get the ball rolling.
By and large you probably have a tasks you have to implement,
so the first thing you need to do is creating a new branch for the task with convenient name.
most of the time it will be the type of improvement you will do in this branch (i.e. Fix, Feat, Bug,) followed by the name of the feature you going to develop.
Suppose that you have a new feature to implement is about building user login functionality so we can name the branch to be something like that:
Feat/login
"Feat" is a shortcut for Feature and followed by the name of the feature, you should be descriptive and following the best practice.
let's go to the next step.
After creating the branch locally and on GitHub then you need to checkout to the branch ( switch to the new branch ), with this command " git checkout Feat/login ".
have you switched?
No! don't panic this usually happens, sometimes the branch does not appear but you can write this command "git fetch" to force git look for changes then write this command "git branch -a" to see if appeared in branches list.
Now checkout again you will be switched.
After that you have to pull in the original code from the master branch to the new branch and that's because if there's another team member who pushed a new improvement to the master you can get it to avoid conflict. if you didn't do that you will be prone to conflicts and bugs, i warned you.
This is awesome, now you are totally ready to start coding.
Have you finished your task? Really? I'm surprised at how active you are.
Now it's the time to push our code to our "Feat/Login" branch.
Write the " add . " command and after that, you have to commit the changes.
But pay attention to your commit messages, choose the right words that describe what changed with this commit especially if you make many commit "Micro-commits",
to let your team leader or anyone who is looking at your code knows what you changed.
Micro-Commits is one of the strategies you could use to give thorough steps about changes, such as " Form Created ", " CSS Applied ", and so on.
Wait a second don't push it yet, please pull the code again from the master "git pull origin master", you don't know if there's anything changed while you were implementing your login feature, right? especially if the task took a lot of time and your team is big.
Have you pulled the code? now you're ready to push your code to the new branch you created " git push origin Feat/login "
Finlay, select the new branch on GitHub then you will find a message telling you if you want to make a new pull request
Click on it and you will be redirected to the second page to check if you have a conflict.
Pull request simply you're saying to your colleague that you have changed the code and you want them to review and merge it with the master
That's it, not hard but effective.
Now your feature is created and ready to be tested by the testers. after they approve it they will merge it with the master to go live.
congrats buddy you really did a great job and deserve a holiday.
Top comments (0)