$ git config --global user.name "James Bond"
$ git config --global user.email '007@mi6.uk'
What if --global
is dropped?
$ cd /your/project/dir
$ git init
$ git clone https://your-bitbucket-userid@bitbucket.org/ppk-teach/tools.git
If you have set up your ssh key you can also use
$ git clone git@bitbucket.org:ppk-teach/tools
$ git add README.md # This stages the file for commit
$ git commit # This will start an editor to record commit message'
$ git commit -m 'Added a readme'
# -m sets the one line commit message
# no editor is started.
$ git commit -a README.md -m 'added a readme'
$ hack hack hack
$ git commit -am 'more detailed install process in readme'
# Added all the modifications to tracked files and commit
Which is the editor started for commit? How can one set it?
$ git branch # See branches
* master # Only one branch master and you are on it
$ git branch topic # Create a topic branch
$ git checkout topic # Move to topic branch
$ git branch
master
* topic
$ do stuff on topic
$ git checkout master # move back to master
$ git merge topic # merge the changes to topic
$ git push # Send our changes to upstream
$ git fetch # get changes but do not merge
$ git pull # fetch and merge.
pull = fetch + merge
safer to use fetch, review mer
$ cd code/git/raaz
$ git remote -v
abhijaju https://github.com/abhijaju/raaz.git (fetch)
abhijaju https://github.com/abhijaju/raaz.git (push)
build ppk@ppk.cse.iitk.ac.in:code/git/raaz (fetch)
build ppk@ppk.cse.iitk.ac.in:code/git/raaz (push)
...
origin git@github.com:piyush-kurur/raaz.git (fetch)
origin git@github.com:piyush-kurur/raaz.git (push)
...
upstream git@github.com:raaz-crypto/raaz.git (fetch)
upstream git@github.com:raaz-crypto/raaz.git (push)
$ git fetch abhijaju/master # Bring abhimanyu's changes
$ git checkout abhijaju/master # See his snapshot.
# review the changes
$ git checkout master # Back to master
$ git merge abhijaju/master # Looks good so merge.
$ git push origin # Send it to my fork on github
$ git push upstream # Send changes to upstream
# Yeah I am the king here.
init
or clone
add
or stage thempush
, fetch
,branch
, merge
z.$ ssh-keygen
$ ls $HOME/.ssh/
...
id_rsa # Private key (keep it safe)
id_rsa.pub # public key (upload on bitbucket)
More details on my blog on key based access