Git workflow: Remote¶
In this module, you will learn how to work with a remote repository using GitHub and GitLab (look at the tutorial).
You will clone a remote repository, update your local repository and push changes to the remote.
Additionally, you will learn how to create a Merge Request to propose changes to the original repository.
- Clone an existing repository from the remote.
- Update the local repository with changes made on the remote repo.
- Push changes from the local repository to the remote.
- Create a Merge Request to propose changes to the original repository.
⚒️ Tutorial: Work with the remote repository (GitLab)¶
1. Create and clone a repository¶
To clone a repository means to download the files from the remote repository to your computer and to create a connection between them.
To clone a repository:
- Open a terminal and go to the directory where you want to clone the files
Copy the Git SSH URL of the repository (REPO_URL)
Clone the repository using the command
git clonein the CLI.
Git automatically creates a folder with the repository name and downloads the files there.
2. Create and Update
dev branch, push it to the remote¶
Now let’s see how to work with a remote repository using GitHub.
- First, we navigate to our 3-git-remote directory using the command
dev. In this way, you can make changes without affecting the main codebase. And we immediately switch to a new branch with the command
git checkout -b dev.
touchcommand and add a line to it using
echo "repo: project-1-git" >> config.yaml. We confirm the changes using
cat config.yaml. This command will print the file’s content.
git push origin devcommand.
3. Create a Merge Request:
Create a Merge Request via GitHub or GitLab UI to the
Congratulations on completing this tutorial! 🥳
You have learned how to work with a remote repository. You set up SSH to connect to GitHub / GitLab, cloned a remote repository, updated your local repository, and pushed changes to the remote.
Furthermore, you learned how to create a Merge Request to propose changes to the original repository.
🎓 Additional Resources:¶
- Git Security SSH
- GitLab documentation
- GitLab tutorials
- Git documentation
- GitHub Git cheat sheet
- Using Git source control in VS Code
Contribute to the community! 🙏🏻
Hey! We hope you enjoyed the tutorial and learned a lot of useful techniques 🔥
Please 🙏🏻 take a moment to improve our tutorials and create better learning experiences for the whole community. You could
- ⭐ Put a star on our ML REPA library repository on GitHub
- 📣 Share our tutorials with others, and
- Fill out the Feedback Form We would appreciate any suggestions or comments you may have
Thank you for taking the time to help the community! 👍