Saturday, 25 April 2015

git braindump

random git stuff:

git - as in old git 

~/.netrc :

machine login meusername password really?

man gittutorial - also:

        1. Everyday Git

        2. Git User’s Manual

        3. Git concepts chapter of the user-manual

        4. howto

        5. Git API documentation


git config --global "Your Name Comes Here"
git config --global
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
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...