Git - Commands
Git - Commands
-------------------------------------------------------------------
commit 2294b5782eb1510fe37fbeac5586c011cd4de733
Author: Kaushal Kumar <[email protected]>
Date: Thu Feb 22 14:07:31 2024 +0530
added git-demo project to local repo
Summary -
*** now our code is in our local repository. so this is the way we
can push our changes to a local repository and we can log and track the changes or
commit changes.
Step 10 - now we need to move our changes from local repository to remote
repository. Let's push local repository changes to Remote Repository. In
Project Directory open git bash here
Step 11 - need to set Local Repo. to Remote Repo. through Command Line. -> $ git
remote add origin https://github.com/kaushal8707/git-demo.git
Step 12 - now we set the origin to our remote repository. now we need to push our
changes now.
Step 13 - now Let's push the changes now to Remote Repository -> $ git push -u
origin master
Step 14 - let's see how we can checkout the code or how we can take an update/pull.
Earlier we have seen how to move code from local repo to remote repo.When u joined
any org they provided the link for the repo and asked to do the local setup let's
see how we can do or how you can checkout.
Step 15 - go to the workspace and open git bash here. (u have the repo link) -
> $ git clone https://github.com/kaushal8707/git-demo.git
Step 16 - whetever the code avails to ur remote repository it came to your local
repository.
now we have the code we can import to our intellij and we can work on
it. assume few more developer is working on to the same repository. suppose one
developer done some changes and push his changes to the remote repository. so let's
do some changes manually on git remote repo so that using git pull we can take the
update in our local repository.
Step 17 - I was unknowing about the changes done on remote repo. so how that
changes will reflect in my local. so for that
go to your working directory and open git bash here.
now we are in our local repository -> $ git pull origin
master - we want to pull from origin master branch
Step 18 - Note - to avoid the conflict always before pushing the changes to remote
repository first take the pull.
Stage 3-- Git Branch & Merge (We will see How to create a seperate Branch in git
and How we can merged it to a master branch)
-----------------------------------------------------------------------------------
-------------------------------