Modul praktis Level 2 VibeKoding: Alur Kerja Git & GitHub: Mesin Waktu Kode.Modul praktis Level 2 VibeKoding: Alur Kerja Git & GitHub: Mesin Waktu Kode.
In previous chapters, we learned how to use web-based vibe coding tools to write code. Each conversation could generate a new version of the code. But that raises an important question: if we want to return to an earlier version, is there a convenient way to do it? Is there a tool that can record our code at different stages so we can switch between versions freely?In previous chapters, we learned how to use web-based vibe coding tools to write code. Each conversation could generate a new version of the code. But that raises an important question: if we want to return to an earlier version, is there a convenient way to do it? Is there a tool that can record our code at different stages so we can switch between versions freely?
That is exactly why version control software exists. In this chapter, we will introduce the most famous version control system, Git, and the most popular code hosting platform, GitHub. You will learn how to manage code with Git, how to download code from GitHub, how to upload your own work, and how to collaborate with others on larger projects.That is exactly why version control software exists. In this chapter, we will introduce the most famous version control system, Git, and the most popular code hosting platform, GitHub. You will learn how to manage code with Git, how to download code from GitHub, how to upload your own work, and how to collaborate with others on larger projects.
Whether you are tracking changes in a personal project, synchronizing code with teammates, or contributing to open source, Git and GitHub are essential tools for modern developers. Once you understand them, you can manage code more confidently, create checkpoints whenever needed, move between different stages of a project, and keep every change traceable.Whether you are tracking changes in a personal project, synchronizing code with teammates, or contributing to open source, Git and GitHub are essential tools for modern developers. Once you understand them, you can manage code more confidently, create checkpoints whenever needed, move between different stages of a project, and keep every change traceable.
> ๐ก Prerequisites> ๐ก Prerequisites
>>
> Before learning Git, it helps to understand:> Before learning Git, it helps to understand:
> - [What Is the Terminal / Command Line](/en/appendix/2-development-tools/command-line-shell)> - [What Is the Terminal / Command Line](/en/appendix/2-development-tools/command-line-shell)
> - [What Is Git](/en/appendix/2-development-tools/git-version-control)> - [What Is Git](/en/appendix/2-development-tools/git-version-control)
>>
> This chapter focuses on the GitHub workflow and hands-on usage, while the links above cover the core fundamentals.> This chapter focuses on the GitHub workflow and hands-on usage, while the links above cover the core fundamentals.
Before using Git, make sure you already understand the basics of the command line and Git itself. This chapter assumes you have that foundation and moves directly into installation, configuration, and practical GitHub collaboration.Before using Git, make sure you already understand the basics of the command line and Git itself. This chapter assumes you have that foundation and moves directly into installation, configuration, and practical GitHub collaboration.
We will briefly walk through installation on the three major operating-system families.We will briefly walk through installation on the three major operating-system families.
๐ผ๏ธ Alur Kerja Git & GitHub: Mesin Waktu KodeAlur Kerja Git & GitHub: Mesin Waktu Kode
๐ผ๏ธ Alur Kerja Git & GitHub: Mesin Waktu KodeAlur Kerja Git & GitHub: Mesin Waktu Kode
๐ผ๏ธ Alur Kerja Git & GitHub: Mesin Waktu KodeAlur Kerja Git & GitHub: Mesin Waktu Kode
Git Bash Here, the installation succeeded.After installation, right-click on the desktop. If you see Git Bash Here, the installation succeeded.๐ผ๏ธ Alur Kerja Git & GitHub: Mesin Waktu KodeAlur Kerja Git & GitHub: Mesin Waktu Kode
On macOS, you can first run git --version in Terminal to check whether Git is already installed. If it is not, macOS often prompts you to install the developer tools automatically.On macOS, you can first run git --version in Terminal to check whether Git is already installed. If it is not, macOS often prompts you to install the developer tools automatically.
If you have [Homebrew](https://brew.sh/), open Terminal and run brew install gitIf you have [Homebrew](https://brew.sh/), open Terminal and run brew install git
You can also install Xcode or the Xcode Command Line Tools from Apple. Git is included as part of that toolchain.You can also install Xcode or the Xcode Command Line Tools from Apple. Git is included as part of that toolchain.
Most Linux distributions install Git through the system package manager:Most Linux distributions install Git through the system package manager:
bash sudo apt update sudo apt install git
bash sudo yum install git
To verify the installation, run git --version. If a version number appears, Git is ready.To verify the installation, run git --version. If a version number appears, Git is ready.
After installing Git, the first thing you should do is configure your user information. Run the following commands in the terminal and replace the values with your own:After installing Git, the first thing you should do is configure your user information. Run the following commands in the terminal and replace the values with your own:
bash # Set the global username shown in commit history git config --global user.name "Your Name" # Set the global email, ideally the same one you use on GitHub git config --global user.email "your.email@example.com"
Git writes this information into every commit as the author identity. When you inspect the version history, you can clearly see who changed what and communicate more easily in collaborative projects.Git writes this information into every commit as the author identity. When you inspect the version history, you can clearly see who changed what and communicate more easily in collaborative projects.
You can confirm the configuration with:You can confirm the configuration with:
bash git config --list
GitHub is a code hosting platform built on top of Git. It provides remote storage for Git repositories and adds collaboration tools such as Issues, Pull Requests, and Projects. In simple terms, Git is the local version-control tool, while GitHub is the remote code warehouse and collaboration layer.GitHub is a code hosting platform built on top of Git. It provides remote storage for Git repositories and adds collaboration tools such as Issues, Pull Requests, and Projects. In simple terms, Git is the local version-control tool, while GitHub is the remote code warehouse and collaboration layer.
GitHub is also the world's largest and most influential open-source community. The idea of open source is that anyone can download and run the source code of a project. That allows people around the world to inspect each other's work, improve it, and build new things on top of it.GitHub is also the world's largest and most influential open-source community. The idea of open source is that anyone can download and run the source code of a project. That allows people around the world to inspect each other's work, improve it, and build new things on top of it.
๐ผ๏ธ Alur Kerja Git & GitHub: Mesin Waktu KodeAlur Kerja Git & GitHub: Mesin Waktu Kode
Large companies often open-source tools and tutorials on GitHub as part of their technical strategy. In the GitHub ecosystem, the number of stars a project receives is one of the most visible indicators of trust and influence.Large companies often open-source tools and tutorials on GitHub as part of their technical strategy. In the GitHub ecosystem, the number of stars a project receives is one of the most visible indicators of trust and influence.
๐ผ๏ธ Alur Kerja Git & GitHub: Mesin Waktu KodeAlur Kerja Git & GitHub: Mesin Waktu Kode
In this course, many supporting resources and assignments are also published in GitHub repositories. By learning to upload your own work there, you gradually build the workflow you will use for real application development later.In this course, many supporting resources and assignments are also published in GitHub repositories. By learning to upload your own work there, you gradually build the workflow you will use for real application development later.
Sign up in the top-right corner.Visit [GitHub](https://github.com/) and click Sign up in the top-right corner.๐ผ๏ธ Alur Kerja Git & GitHub: Mesin Waktu KodeAlur Kerja Git & GitHub: Mesin Waktu Kode
Next, let's create your first repository, often shortened to repo.Next, let's create your first repository, often shortened to repo.
๐ผ๏ธ Alur Kerja Git & GitHub: Mesin Waktu KodeAlur Kerja Git & GitHub: Mesin Waktu Kode
๐ผ๏ธ Alur Kerja Git & GitHub: Mesin Waktu KodeAlur Kerja Git & GitHub: Mesin Waktu Kode
When creating a repository, the main fields mean:When creating a repository, the main fields mean:
Private: only you and people you explicitly invite can see itPrivate: only you and people you explicitly invite can see itPublic: anyone can see itPublic: anyone can see it.gitignore tells Git which files or folders should not be tracked, such as temporary files, dependency folders, or local secrets..gitignore tells Git which files or folders should not be tracked, such as temporary files, dependency folders, or local secrets.license determines how others are allowed to use your open-source code.license determines how others are allowed to use your open-source code.For your first repository, it is reasonable to check Add README, set the visibility to Private, and fill in a name and description you like. Then click Create repository.For your first repository, it is reasonable to check Add README, set the visibility to Private, and fill in a name and description you like. Then click Create repository.
๐ผ๏ธ Alur Kerja Git & GitHub: Mesin Waktu KodeAlur Kerja Git & GitHub: Mesin Waktu Kode
You will now have a clean repository, ready for your files.You will now have a clean repository, ready for your files.
๐ผ๏ธ Alur Kerja Git & GitHub: Mesin Waktu KodeAlur Kerja Git & GitHub: Mesin Waktu Kode
To download a repository, you use git clone, which requires the repository URL. You can find that by clicking the green Code button. GitHub usually shows both HTTPS and SSH options.To download a repository, you use git clone, which requires the repository URL. You can find that by clicking the green Code button. GitHub usually shows both HTTPS and SSH options.
๐ผ๏ธ Alur Kerja Git & GitHub: Mesin Waktu KodeAlur Kerja Git & GitHub: Mesin Waktu Kode
In general, HTTPS is fine for temporary downloads or quick testing, but for your own daily development workflow, SSH is usually the better experience.In general, HTTPS is fine for temporary downloads or quick testing, but for your own daily development workflow, SSH is usually the better experience.
In GitHub, "binding SSH" means connecting your local machine's SSH public key to your GitHub account so GitHub can recognize your device through the SSH protocol. Once set up, you can clone, pull, and push securely without re-entering passwords every time.In GitHub, "binding SSH" means connecting your local machine's SSH public key to your GitHub account so GitHub can recognize your device through the SSH protocol. Once set up, you can clone, pull, and push securely without re-entering passwords every time.
In plain language: it is like giving your device a special access card for GitHub.In plain language: it is like giving your device a special access card for GitHub.
> ๐ก What is SSH?> ๐ก What is SSH?
GitHub supports two major protocols for repository operations:GitHub supports two major protocols for repository operations:
SSH binding is the prerequisite for using GitHub with SSH. You must upload your local SSH public key to GitHub so GitHub can verify your machine.SSH binding is the prerequisite for using GitHub with SSH. You must upload your local SSH public key to GitHub so GitHub can verify your machine.
SSH authentication depends on a key pair:SSH authentication depends on a key pair:
When you perform a Git operation over SSH:When you perform a Git operation over SSH:
The core workflow is simple: generate a key pair โ upload the public key to GitHub.The core workflow is simple: generate a key pair โ upload the public key to GitHub.
Prompt:Prompt:
Help me create the SSH key needed for GitHub login. My email is your_email@gmail.com. Please return the public key for me to copy.Help me create the SSH key needed for GitHub login. My email is your_email@gmail.com. Please return the public key for me to copy.
๐ผ๏ธ Alur Kerja Git & GitHub: Mesin Waktu KodeAlur Kerja Git & GitHub: Mesin Waktu Kode
After entering the prompt, you may still need to press Enter in the terminal pane so the command can continue. Once Trae finishes, it will show you the public key to copy.After entering the prompt, you may still need to press Enter in the terminal pane so the command can continue. Once Trae finishes, it will show you the public key to copy.
๐ผ๏ธ Alur Kerja Git & GitHub: Mesin Waktu KodeAlur Kerja Git & GitHub: Mesin Waktu Kode
Open your terminal and run ssh-keygen -t ed25519 -C "your_email@example.com"Open your terminal and run ssh-keygen -t ed25519 -C "your_email@example.com"
Press Enter to accept the defaults unless you want a custom path or passphrase. This creates:Press Enter to accept the defaults unless you want a custom path or passphrase. This creates:
id_ed25519: your private key, which must stay localid_ed25519: your private key, which must stay localid_ed25519.pub: your public key, which you will upload to GitHubid_ed25519.pub: your public key, which you will upload to GitHubThis is the binding step itself.This is the binding step itself.
C:\Users\\.ssh\id_ed25519.pub On Windows, open C:\Users\\.ssh\id_ed25519.pub cat ~/.ssh/id_ed25519.pubOn macOS/Linux, run cat ~/.ssh/id_ed25519.pubSettings โ SSH and GPG keys โ New SSH keyIn GitHub, go to your avatar โ Settings โ SSH and GPG keys โ New SSH key๐ผ๏ธ Alur Kerja Git & GitHub: Mesin Waktu KodeAlur Kerja Git & GitHub: Mesin Waktu Kode
๐ผ๏ธ Alur Kerja Git & GitHub: Mesin Waktu KodeAlur Kerja Git & GitHub: Mesin Waktu Kode
๐ผ๏ธ Alur Kerja Git & GitHub: Mesin Waktu KodeAlur Kerja Git & GitHub: Mesin Waktu Kode
Run ssh -T git@github.comRun ssh -T git@github.com
If you see a message similar to Hi [your GitHub username]! You've successfully authenticated..., the setup worked.If you see a message similar to Hi [your GitHub username]! You've successfully authenticated..., the setup worked.
git@github.com:username/repository.git, not HTTPS URLs.After setting up SSH, use SSH repository URLs such as git@github.com:username/repository.git, not HTTPS URLs.git remote set-url origin If you cloned a repository over HTTPS earlier, you can switch it with git remote set-url origin Now that we have covered Git, GitHub, SSH, and the setup process, you can start asking Trae to help with Git operations.Now that we have covered Git, GitHub, SSH, and the setup process, you can start asking Trae to help with Git operations.
git clone: download an existing repositorygit clone: download an existing repositoryYou can directly tell Trae which repository URL you want to clone.You can directly tell Trae which repository URL you want to clone.
๐ผ๏ธ Alur Kerja Git & GitHub: Mesin Waktu KodeAlur Kerja Git & GitHub: Mesin Waktu Kode
git pull: fetch the latest remote updatesgit pull: fetch the latest remote updatesBefore editing, especially in a shared repository, you should pull the latest changes first.Before editing, especially in a shared repository, you should pull the latest changes first.
Always include the folder name and its relative or absolute path so you do not pull in the wrong repository by mistake.Always include the folder name and its relative or absolute path so you do not pull in the wrong repository by mistake.
Prompt:Prompt:
Help me pull this repository AIID-TEST in ./AIID-TEST.Help me pull this repository AIID-TEST in ./AIID-TEST.
git commit and git push: stage, save, and upload your updatesgit commit and git push: stage, save, and upload your updatesAfter you modify files locally, you can ask Trae to detect the changes and help you push them to GitHub.After you modify files locally, you can ask Trae to detect the changes and help you push them to GitHub.
Prompt:Prompt:
I finished. Commit and push to the repository AIID-TEST in ./AIID-TEST.I finished. Commit and push to the repository AIID-TEST in ./AIID-TEST.
๐ผ๏ธ Alur Kerja Git & GitHub: Mesin Waktu KodeAlur Kerja Git & GitHub: Mesin Waktu Kode
If the push succeeds, you will be able to see the updated content on GitHub immediately.If the push succeeds, you will be able to see the updated content on GitHub immediately.