How to set up your git workflow

Go to Github and get your shared (not your fork) repo.

Create a fork as well.

copy the url:

It doesn’t matter what branch you’re on, cloning takes all branches with it.

git clone <paste>

Go to your project.

YOU-MBP:~ YOU-Name$ cd YourProject/

Rename your origin

Scotts-MBP:akin scottlydon$ git remote rename <old-name> <new-name>

Like so:

Scotts-MBP:akin scottlydon$ git remote -v 
origin https://github.com/ElevatedUnderdogs/akin.git (fetch)
origin https://github.com/ElevatedUnderdogs/akin.git (push)

Now add your fork as your origin.

For example:

Scotts-MBP:akin scottlydon$ git remote add origin https://github.com/scott-lydon/akin-1.git

Now lets create a develop branch if the main repo doesn’t have one. Type a unique name for your new branch, then select Create branch. Lets call it develop.

click “create branch”

Lets fetch the remote branch now:

git fetch upstream
git branch

If it shows

*master

Thats cool.

Now you are ready to create your local develop branch

git checkout -b develop upstream/develop

Make sure you spell your remote correctly or you might get some errors.

If you accidentally created a local branch, you can delete it by switching to master

git checkout master

, then running:

git branch -d <yourUnwantedBranch>

Now you can create a develop branch locally:

git checkout -b develop upstream/develop

When you want to push to this branch

git push origin branchName

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store