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)
Copy the Git 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! π