Saturday, 25 April 2015

git braindump

random git stuff:

git - as in old git 


~/.netrc :

machine github.com login meusername password really?

man gittutorial - also:

        1. Everyday Git
           file:///usr/share/doc/git-1.8.3.1/everyday.html

        2. Git User’s Manual
           file:///usr/share/doc/git-1.8.3.1/user-manual.html

        3. Git concepts chapter of the user-manual
           file:///usr/share/doc/git-1.8.3.1/user-manual.html#git-concepts

        4. howto
           file:///usr/share/doc/git-1.8.3.1/howto-index.html

        5. Git API documentation

           file:///usr/share/doc/git-1.8.3.1/technical/api-index.html

git config --global user.name "Your Name Comes Here"
git config --global user.email you@yourdomain.example.com
git init
git add .
git commit
git add files
git diff --cached
git commit -a
git pull origin master
git push origin master
git remote add origin https://github.com/stuartabramshumphries/learning-python
git status -s
git show
At any point you can view the history of your changes using
git log (--oneline)
If you also want to see complete diffs at each step, use
git log -p
Often the overview of the change is useful to get a feel of each step
git log --stat --summary
to rename current branch:git branch -m newname
to rename outsidegit branch -m branch1 renamedbranch

to list branches in order:

git  for-each-ref --sort=-comitterdate refs/heads (can add format here etc)

couple of things I found a bit odd when I started using git:
whats origin - this is just an alias to a remote. by default its set as the place you cloned repo from (view it as 'original' place) - however its an alias and can be changed.
so git push origin branchname means push my local branchname to originalplace. (usually!)

whats a detached head - thats a commit that doesnt point to a branch or HEAD. View it like pointers on a linux filesystem.

No comments:

Post a Comment

bash best practices

Bash best practices A few hints on bash best practice: * use #!/usr/bin/env bash .. this is more portable but you cant rely on a spe...