Skip to content

Instantly share code, notes, and snippets.

@davidvanvickle
Last active December 17, 2015 21:09
Show Gist options
  • Save davidvanvickle/5672991 to your computer and use it in GitHub Desktop.
Save davidvanvickle/5672991 to your computer and use it in GitHub Desktop.
GIT on bitbucket notes
GIT on bitbucket notes
Set up
1. Identify yourself
# git config --global user.name "My Name"
# git config --global user.email me@email.com
2. Set up SSH keys - add .ssh/id_rsa.pub to bitbucket
https://bitbucket.org/account/user/[username]/ssh-keys/
Fork and Clone a bitbucket repo
1. Fork a bitbucket repo
2. Create local repo
# git init
3. Clone into local repo and add remote callback
# git clone https://newuserme@bitbucket.org/newuserme/bb101repo.git
# git remote add origin https://newuserme@bitbucket.org/newuserme/bb101repo.git .
4. Pull code
# git pull origin master
Work on a project
1. Update bitbucket fork from master
2. Update local files
# git pull origin master
3. Make changes
4. Commit changes
# git add .; git commit -a -m "updated x y z"
5. Push commit
# git push origin master
6. Submit a pull request on bitbucket
Branching
1. See existing branches
# git branch
2. Create a new branch
# git checkout -b newbranchname
3. Commit changes
# git add .
# git commit -a -m "my new idea"
4. Push branch to bitbucket
# git push origin newbranchname:newbranchname
5. Merge branch into master
# git checkout master; git merge --no-ff newbranchname
6. Delete remote branch
# git push origin :newbranchname
7. Delete local branch
# git branch -d newbranchname
Create a code repo
#cd /path/to/my/repo
#git remote add origin ssh://git@bitbucket.org/[user]/[reponame].git
[ create, add, commit something ]
#git push -u origin --all # to push up the repo for the first time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment