April 12, 2018

Git workflow for absolute beginners

I hope the guide below will be useful and helpful to new developers :)

Let's assume we have two branches - master and development. Now to add a feature or perform a bug fix we should do the following.

1. Clone repo

[ git clone ]

2. Fetch repo and switch to development branch

[ git fetch && git checkout development ]

3. Create a new branch for your changes

[ git branch sample-branch ]

4. Check the list of available branches

[ git branch ]

5. Switch to newly created branch

[ git checkout sample-branch ]

6. Make required changes in code and test the feature or bug fix

7. Check the changed files

[ git status ]

8. Stage the changed files

[ git add --all ]

9. Commit the staged files

[ git commit -m "your message" ]

10. Switch back to development branch

[ git checkout development ]

11. Update development branch from remote repository

[ git pull origin development ]

12. Merge the sample-branch into development branch.

[ git merge sample-branch ]

13. Push the changes in development branch to remote repository

[ git push origin development ]

14. Once done and tested, delete the sample-branch

[ git branch -d sample-branch ]

© 2023 [maxico.dev] — All rights reserved.