This quick win is for complete beginners who want to start building AI-assisted apps in an organized, collaborative way. A clean, safe workspace is essential, especially on large projects. With Git and GitHub, you'll learn how to track changes, work with other developers and keep your code under control at all times. You'll also find a set of prompts that walk you step by step through setting up and running your development environment.
How Git works, step by step
Creating the local repository
The first step in working with Git is creating a local repository. This is the workspace where Git starts tracking changes to your files. When needed, you can link it to a remote repository so you can work with others.
Tracking and saving changes
Once you've created or edited files, you pick which ones Git should track. The process looks like this:
- Add the changed files to a "waiting area" (the staging area).
- Check the project status to see which files are ready to be saved.
- Save the project state for good, with a message that describes the changes you made.
Working with branches
Git lets you work on separate branches to build new features or fix bugs without touching the main project. The flow goes like this:
- Create a new branch for each new feature or change.
- Switch between branches to work on specific parts of the project.
- Merge the changes from the side branches into the main branch once the work is done.
Syncing with a remote repository
To work with others or keep the project online, Git gives you tools to sync your local work with a remote repository. That includes:
- Uploading your local changes to the remote repository to share them.
- Downloading updates from the remote repository to bring in other people's work.
This sequence is the basic Git cycle, from creating the project to working as a team. Now let's see how to use AI to generate the commands. One caveat first: with modern IDEs you can just give an order like "commit the changes", but right now there's a real risk they'll make a mess. It's better to keep tighter control. Besides, you'll learn the commands quickly and won't need the prompts anymore. Still, I think they'll come in handy when we start coding by voice.
The prompts you need for each action
Initialize a workspace (repository)
Command name: git init
What it does and when to use it:
It creates an organized space, called a "repository", where Git can track changes to your files. You use it at the start of a project so Git can handle version control.
What's a repository?
It's a special folder where Git keeps a "history" of every change made to your files, so you can go back to earlier versions or work with others.
Generate a Git command to initialize a repository in the current folder
Add files to the staging area
Command name: git add - Add files to the staging area
What it does and when to use it:
It lets you choose which files go into the next save (commit). You use it after creating or editing files you want Git to track.
What's the staging area?
It's a "waiting area" where you put the files that are ready to be saved with a commit, so you control what goes into the save.
Generate a Git command to add the file [file name] to the next save.
Check what changed in your workspace
Command name: git status - Check what changed in your workspace
What it does and when to use it:
It shows you which files were changed, which are ready to be saved and which are still "untracked". You use it to check the status of the project.
Generate a Git command to check the status of the files in the current repository.
Save a snapshot of your work with a description
Command name: git commit -m - Save a snapshot of your work with a description
What it does and when to use it:
It permanently saves the changes in the staging area to the local repository, with a message that describes what you did. You use it to record a stable or important version of the project.
What's a commit?
A commit is like taking a photo of the project at a given moment, with a caption to remind you what was done.
Generate a Git command to save the local changes with the message '[list the changes]'.
Create separate paths for new ideas
Command name: git branch
What it does and when to use it:
It creates new "branches" of the project or lists the existing ones. You use it to build new features without affecting the main branch.
What's a branch?
A branch is like a parallel path for the project, where you can work on ideas or changes without risking the main work.
Generate a Git command to create a branch called 'feature-login'.
To see all the branches
Generate a Git command to list all the branches in the project.
Switch to a branch to work on it
Command name: git checkout - Switch to a branch to work on it
What it does and when to use it:
It moves you to another branch of the project or restores files to an earlier version. You use it to start working on a specific feature or version.
What's a checkout?
Checkout is the operation that lets you move between branches or bring back earlier versions of files in the project.
Generate a Git command to switch to the branch '[Branch Name]'.
Combine the work of two branches
Command name: git merge - Combine the work of two branches
What it does and when to use it:
It combines the changes from one branch (say, a new feature) with another branch. You use it to bring the work done on a side branch into the main branch.
What's a merge?
A merge takes the changes from one branch and combines them with those of another, keeping the history intact.
Generate a Git command to merge the branch 'feature-login' into the main branch 'main'.
Publish your work online (remote repository)
Command name: git push - Publish your work online (remote repository)
What it does and when to use it:
It sends your local commits to a remote repository (for example, on GitHub). You use it to share your work with the team or sync it online.
What's a remote repository?
A remote repository is a copy of the project stored on an online server, available to everyone working on it.
Generate a Git command to upload the local changes on the 'main' branch to GitHub.
Download updates from a remote repository
Command name: git pull - Download updates from a remote repository
What it does and when to use it:
It fetches the latest changes from a remote repository and merges them into your local one. You use it to keep your local work in sync with the team's.
What's a pull?
A pull is an operation that downloads the updates from the remote repository and merges those changes into your local work in one go.
Generate a Git command to download and merge the changes from the remote repository into the 'main' branch
Link a local repository to a remote repository
Command name: git remote add origin - Link a local repository to a remote one
What it does and when to use it:
It tells Git where the remote repository lives (for example, on GitHub). You use it when you want to put your local project online for the first time.
What's an origin?
Origin is the default name for the project's main remote repository.
Prompt to generate the command:
"Generate a Git command to link the local repository to the remote repository 'https://github.com/user/progetto.git'."
Generate a Git command to link the local repository to the remote repository 'https://github.com/user/progetto.git'
That's it for now. See you at the next quick win. Be Smart.
If you found this useful, help me grow. The goal is to become a large, knowledge-hungry community, so we can ask companies for discounts, early access, event invites, funding to keep the project going and perks for Marketing Hackers members. Membership will always be free.
The more of us there are, the more we'll get. So if you like the project, share it with your colleagues and friends and invite them to sign up, so the knowledge spreads and nobody gets left behind.
Stay Tuned!
Cosa ottieni iscrivendoti:
- Accesso a tutti gli episodi della newsletter
- Guide e corsi completi sull'AI per marketer
- Strumenti AI professionali (BrandPix, Short Video Suite)
- Crediti gratuiti per iniziare subito
