Git workflow: Remote¶
๐ Overview¶
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.
๐ฏ Goals¶
- 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 clone
in the CLI.
Note
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
cd 3-git-remote
.
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
.
3. Next, we create a new file called config.yaml
using the touch
command 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.
# Create a config file, make changes, confirm them
touch config.yaml
echo "repo: project-1-git" >> config.yaml
cat config.yaml
git push origin dev
command.
3. Create a Merge Request: dev
โ main
¶
Create a Merge Request via GitHub or GitLab UI to theย main
ย branch
๐ Conclusion¶
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! ๐