Jhonatan Pinheiro
Loading page...
Jhonatan Pinheiro
Loading page...
Jhonatan Pinheiro
Loading page...
The difference between Git and GitHub, the branch and Pull Request flow, issues, Actions, releases, security and using the platform as a portfolio.
Plenty of people learn Git and GitHub as if they were the same thing. They are not — and understanding the difference is the first step to using both well.
You can use Git your whole life without GitHub. What you lose is everything that happens between people.
Git solves versioning, but it leaves three questions open:
format-patch and email — it works, but it comes from the days when Linux was developed over a mailing list.GitHub answers all three: a remote repository as the source of truth, the pull request as a standard way to propose a change, and Actions to automate checking and deployment.
A repository ("repo") is the project: code, history, documentation and configuration.
Three files define the first impression of your repository:
README.md # what it is, how to run it, how to contribute — it becomes the repository's cover
.gitignore # what must never be versioned (node_modules, .env, build)
LICENSE # without a licence, "public" does not mean "free to use"A public repository without a licence is, legally, "all rights reserved". If you want people to use your code, pick a licence — MIT and Apache 2.0 are the most common.
And the warning that outweighs all the others: never commit a secret. A token, a password or a private key in a public repository gets swept up by bots within minutes. If it happened, revoke the credential before anything else — deleting the commit is not enough, because it has already been read.
The cycle that practically every team uses:
# 1. Bring in the current state of the main branch
git switch main
git pull
# 2. Create a branch for your task
git switch -c feat/filtro-por-assunto
# 3. Work in small, descriptive commits
git add .
git commit -m "feat(blog): filtro por assunto na listagem"
# 4. Publish the branch
git push -u origin feat/filtro-por-assunto
# 5. Open the Pull Request (from the site or from the gh CLI)
gh pr create --fillWhy a branch instead of committing straight onto main? Because main should always be publishable. Every change goes through a place where it can be reviewed, tested and undone without affecting whoever depends on it.
GitHub has a command-line client that saves you from going back to the browser:
gh auth login # authenticates the machine
gh repo create meu-projeto --private # creates the repository
gh repo clone usuario/projeto
gh pr create --fill # opens a PR with title/body from the commits
gh pr list
gh pr checkout 42 # pulls down someone else's PR to test it
gh pr review 42 --approve
gh pr merge 42 --squash --delete-branch
gh issue create --title "Bug no filtro" --body "Passos para reproduzir..."
gh run list # Actions runs
gh run watch # follows the current runThe Pull Request (PR) is the heart of GitHub. It says: "I have these changes on this branch and I want to integrate them into that one; please review".
A PR brings together in one place:
What makes a good PR:
| Practice | Why |
|---|---|
| Small (under ~400 lines) | A giant PR gets an "LGTM" without anyone really reading it |
| One subject per PR | Easier to review, to revert and to understand later |
| Clear title and description | The reviewer needs to know the why, not just the what |
| A screenshot or video when it is visual | It saves rounds of "I didn't get what changed" |
| Green CI before asking for review | Do not spend someone else's time on a lint error |
Three ways to merge, and when to use each:
main. The default for most teams: clean history, one commit per feature.In the repository settings you define the rules for main:
This is what turns good intentions into process. Without it, "we agreed to always open a PR" lasts until the first tight Friday.
Issues are the project's tasks, bugs and ideas — each with its own discussion, assignee, labels and milestone.
# In the body of the commit or the PR, this closes the issue automatically on merge:
git commit -m "fix: corrige contraste do tema claro
Closes #42"Features worth knowing:
bug, enhancement, good first issue. The last one is the classic invitation for new contributors..github/ISSUE_TEMPLATE and PULL_REQUEST_TEMPLATE.md standardise what you need to receive.Actions runs tasks automatically when something happens in the repository: a push, an opened PR, a created tag, a time of day.
# .github/workflows/ci.yml
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
verificar:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run lint
- run: npm test
- run: npm run buildWith that, every PR reaches the reviewer with lint, tests and build already verified. The most common uses:
main.on: schedule) — periodic routines, such as checking for broken links or updating dependencies.Two tips that spare you pain: use secrets for credentials (never write a token into the YAML) and pin the version of the actions (@v4, or better, the commit hash) so a third party's update does not catch you by surprise.
gh release create v1.2.0 --generate-notes
gh release upload v1.2.0 ./dist/app.zipGitHub bundles several layers of protection — and most of them just need switching on:
And on your side: use SSH or a token with minimum scope, never a password; and prefer fine-grained tokens, which grant access to specific repositories instead of the whole account.
# SSH key: generate it, add it to the agent and register the public one on GitHub
ssh-keygen -t ed25519 -C "voce@email.com"
ssh-add ~/.ssh/id_ed25519
gh ssh-key add ~/.ssh/id_ed25519.pub
ssh -T git@github.com # tests the connectionFor anyone building a career, the GitHub profile usually gets read before the CV. What really counts:
About the "little green squares": consistency is good, but nobody serious hires because of it. A daily commit with no substance is easy to spot.
| Platform | Stands out for |
|---|---|
| GitHub | The largest community, the best ecosystem, Actions and integrations |
| GitLab | Very complete CI/CD and a mature self-hosted option |
| Bitbucket | Strong integration with Jira and the rest of Atlassian |
| Azure DevOps | Microsoft corporate environments, with boards and pipelines |
| Gitea / Forgejo | Lightweight and self-hosted — the "GitHub at home" |
For a personal project, open source and a portfolio, GitHub is the default choice because of its reach. For a company that requires on-premise data, self-hosted GitLab and Gitea usually enter the conversation.
Git keeps the history of your code. GitHub is where that history meets other people — to review, automate, publish and collaborate.
If you are starting out, the shortest path to real benefit:
good first issue on a project you use and send your first PR.The fifth step is the one that changes the level: it is when GitHub stops being a backup of your code and becomes the place where you work with the rest of the world.