Better than subversion as you can make local commits. Also, apparently like Ferrari compared to Hyundai
'git add –all .
''git status
', make files you want to ignore are not included'git diff <master_name>
', make sure no unintended changes'git commit -m “<meaningful description of what you changed>”
', as 'git log
' only prints the messages, not the diff'git push origin <branch-name>
'Meaning | Command | |
---|---|---|
Create git repo in current directory | git init . | |
Ignore .pyc files | Edit <rootdir>/.git/info/exclude and append *.pyc 1 I use *.pyc, *.dropbox, *.o | |
Add/scan for new files | git add . | |
Commit | git commit -m “<commit message>” | |
Add a remote repo (TODO: only do a subset?) | git remote add origin https://github.com/nolanhergert/test.git | |
Commit to remote repo. Not sure what -u is for | git push -u origin master | |
Add “upstream” repo | git remote add upstream https://github.com/spark/firmware.git | |
Pull changes from remote repo | git fetch origin | |
Check out and track remote branch | git checkout –track origin/newsletter | |
Update local changes with remote changes | git pull that's it?!?! | |
Change branches / commits (be sure to cd inside of directory) | git checkout feature/hal or git checkout 01234567 | |
Git bisect (find bugs using binary search)! | ||
Add all modified files (don't have to do git rm from cmd line) | git add -A . | |
Delete All Branches older than XX weeks | for k in $(git branch | sed /\*/d); do if [ -z "$(git log -1 --since='1 week ago' -s $k)" ]; then git branch -D $k fi done (stackoverflow is wrong) | |
Create patch file | git diff 01234567^! --ignore-all-space > diff.patch | |
Revert local working copy / uncommitted files | git reset --soft HEAD^ | |
View git log | git reflog | |
UNDO STUFF | git reset --hard HEAD@{X} | |
Find by tag | git tag -l “*971*” | |
Checkout tag | git checkout tags/SPS_IA_54.00.01.971.0 | |
Ignore branch merges | git log –no-merges –first-parent , or just use GitExtensions and view current branch only | |
Interactive rebase | git rebase -i <branch name whose commits you want to diff from, usually master> (will rewrite the history of the current branch you're on, so you might want to make a new branch first) | |
Interactive checkout / diff \ Used for reverting changes from master for a selective push | git checkout -p <other branch> | |
Revert is not a reset! | If you merge a separate branch but then don't want to actually do it. Reverting is not good enough. You have to reset –hard HEAD | to delete the merge commit or in the worst case do an interactive rebase. Otherwise the branch commits are in your branch, they're just undone with a separate commit! |
http://jsfiddle.net/yzj591tu/. Uses http://gitgraphjs.com/, It's ok…
I know enough from hacking around on git to get it working for me, but I am by no means an expert!
To set it up on your computer:
w00t, you now you have a working clone of a repository! To work on the code:
Unable to negotiate with XX.XXX.XX.XX: no matching host key type found. Their offer: ssh-dss fatal: Could not read from remote repository.
For me this worked: (added into ~\.ssh\config)
Host * HostkeyAlgorithms +ssh-dss PubkeyAcceptedKeyTypes +ssh-dss
Just because.
To see changes based on an ID use Search→Go To→123456
Use find file or find by change set (Ctrl+G) to find what you're looking for.
Too bad there's not, “within this file find diff containing foo”, but maybe there is!