33.3 Git Developer Workflow Pre Coding

20210924

Also see Section 33.40 and following for other workflow suggestions.

1. Clone a Repository A generic git workflow for a team, with developers working on specific tasks/tickets/issues, begins with a clone of the repository. The URI identifies the repository (e.g., git@github.com:...) and can be obtained from the Code button of the github repository through the browser. The command to clone is:

git clone git@github.com:<owner>/<repo>.git

2. Create a Branch For a specific task create a branch, generally from the main branch, to encapsulate the work. Suppose, for example, the developer known as kayon will add a feature to validate user input for the app his team are working on, the branch might be called kayon/validator.

We begin by ensuring the main branch is the default:

git checkout main

Next, download to the local copy any changes that have been made to the main branch in the remote repository.

git pull --rebase

Next create a new branch using (-b) with checkout, which also sets that branch as the local default, and then push it to upstream.

git checkout -b kayon/validator
git push --set-upstream origin kayon/validator

The checkout command with -b creates the branch and checks it out. To only create the branch and later separately checkout:

git branch kayon/validator
git checkout kayon/validator

3. Coding Undertake the activity on that branch locally and commit (to share your work) regularly to the branch. Test the branch in your development environment.

Continue to the next page for the post-coding workflow.



Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0