Phase 4GitHub

#16 Complete workflow

A-to-Z project

The complete workflow

This lesson is a recap exercise. You will put into practice all the commands learned from the beginning: create a project, initialize Git, write code, commit, push to GitHub, and create a Pull Request.

No new concepts here, just practice to solidify your skills!

Step 1 -- Create the project

Start by creating a folder for your project and initialize Git:

Initialize the project
$ mkdir my-app && cd my-app
$ git init
Initialized empty Git repository in /home/user/my-app/.git/
$ git config user.name "Alice"

Step 2 -- Create files and commit

Create your first files and make an initial commit:

First commit
$ touch index.html style.css app.js
$ git add .
$ git commit -m "Initial commit"
[main (root-commit) a1b2c3d] Initial commit
 3 files changed, 0 insertions(+), 0 deletions(-)

Step 3 -- Work on a branch

Create a branch for your feature, make changes, and commit:

Feature branch
$ git checkout -b feature
Switched to a new branch 'feature'

# ... edit files ...

$ git add .
$ git commit -m "Add feature"
[feature b2c3d4e] Add feature
 1 file changed, 10 insertions(+)

Step 4 -- Publish to GitHub

Create a GitHub repository and push your branches:

Publish to GitHub
$ gh repo create my-app --public --source=.
✓ Created repository alice/my-app on GitHub
https://github.com/alice/my-app

$ git push -u origin main
To https://github.com/alice/my-app.git
 * [new branch]      main -> main

$ git push -u origin feature
To https://github.com/alice/my-app.git
 * [new branch]      feature -> feature

Step 5 -- Create a Pull Request

Finally, create a PR to propose your feature:

Create the PR
$ gh pr create --title "Add feature" --body "My first PR"
Creating pull request for feature into main in alice/my-app

https://github.com/alice/my-app/pull/1

Congratulations!

You have completed the full course! You now master the basics of the terminal, bash, Git, and GitHub. You know how to:

  • Navigate and manage files in the terminal
  • Manage permissions and write bash scripts
  • Version your code with Git (add, commit, branch, merge)
  • Collaborate on GitHub (push, pull, PR, issues)
  • Use GitHub CLI to do everything from the terminal

Keep practicing every day and these commands will become second nature. The terminal is a powerful tool that will accompany you throughout your developer journey.

Your turn

Reproduce the complete workflow in the terminal below. Follow the steps in order: create the project, commit, publish, and create a PR.

terminal — bash
user@stemlegacy:~$