Stophface Stophface - 2 days ago 3
Git Question

Working with remote repo git

I am very new to git. I am working with a remote repo.
I set up my my working environemnt like this:

git clone git@... /folder/
git branch -v
# origin git@... (fetch)
# origin git@ ... (push)
git branch someLocalBranch


What would I do if I want to pull changes from the
remote master
into my
local master
? And, how would I go on about
pushing
changes from
someLocalBranch
into a
remote branch
? That
remote branch
can either exist, or does not exist yet.

Answer

your remote url is already set since you have cloned the remote repo. it's named "origin"

so to pull changes from the remote master you simply have to be on your local master branch :

git checkout master

and then :

git pull origin master

if you want to push your changes (after commiting them on your local branch) be sure you're on the someLocalBranch:

git checkout someLocalBranch

then:

git push origin someLocalBranch

it will create the remote someLocalBranch if necessary, or simply push your change if it already exist

Comments