Skip to content

Instantly share code, notes, and snippets.

@aroques
Last active September 9, 2024 15:21
Show Gist options
  • Save aroques/cd872631818328bb78a5ecabcc156775 to your computer and use it in GitHub Desktop.
Save aroques/cd872631818328bb78a5ecabcc156775 to your computer and use it in GitHub Desktop.

Pull down another branch

Pull down changes and checkout

git fetch
git br -r                 # list remote branches
git co -t release/2.0.0   # checkout remote branch locally

Source: https://www.git-tower.com/learn/git/faq/checkout-remote-branch

Stashing changes

git stash save 'Description of stash'
git stash list
git stash apply 

Setup New Repo

Create a repository on Bitbucket or Github.

Locally

To initialize a local git repository, add everything, and commit what you have added:

git init
git add  .
git commit -m "Initial commit"

Then, add the remote repository and push your local changes:

  • On Github:
git remote add origin [email protected]:aroques/[name-of-repo].git
git push -u origin main
  • On Bitbucket
git remote add origin [email protected]:aroques/[name-of-repo].git
git push -u origin main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment