DevOps Classroom notes 12/Mar/2026

Git contd

Remote Repository

  • Overview

Local Repo first and then Remote Repo

  • Create a local repo have atleast one commit
  • Create a remote repo in github (or any other git remote repo)
  • from local repo, establish a connection
git remote add <remote-name> <remote-url>

git remote add origin https://github.com/dummyrepos/my_first_git_repo_feb26.git
git config --list
  • To send changes from local to remote the command is
git push <remote-name> <reference-name>

Remote first and then local

  • you have a remote repo, but nothing local => clone
git clone <remote-url>

git clone https://github.com/dummyrepos/githublearningsep25.git
cd githublearningsep25
git config --list

Conditions

  • when we are connected to a remote repository a branch with name <remote-name>/<branch-name> will be created locally which represents the remote
  • when we are pushing changes the tip of the remote branch and tip of your branch before this change should be same
  • When we are getting latest chagnes
    • changes are fetched from remote into <remote/branch> then merged into local branch pull => fetch + merge
  • Generally its a good idea to pull changes regularly from remote.

Exercise

  1. Create a Local Repo first make two commits in main branch and create a remote repo in github, push the changes after adding remote
  2. Create a remote repo add some changes there
  3. clone the repo
  4. make changes in local and push to remote
  5. make changes in remote and pull the changes
  6. make changes in local and also in remote
    1. use push to notice ther error
    2. Try pull to see Merge commit
  7. make changes in local and also in remote
    1. use push to notice ther error
    2. Try pull –rebase you should not see extra merge commit
  8. Create an extra branch in local and push
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version
%%footer%%