DSPy a system for AI to Write Prompts and Do Fine Tuning
GTFO: Git Theory For OpenSource
1. GIT
THEORY
FOR
OPEN
by Forest SOURCE
Mars
11/4/30
2.
3.
4. “Using Git for web development is
like Shopping for groceries in a
Ferrari”
5.
6. Source Source
Code Code
SCCS
Control Managment
System VCS Software
Software SVSC Configuration
Management
Version RCS SVC
Control Concurrent
System SCM Versioning
System
Version SCMS
SCM Centralised
Control
System
CVS Version
System
Version
11. GITTING STARTED
LINUX
$ sudo yum install git gitweb
$ sudo aptitude install git-core gitweb
OSX
$ sudo port install git-core
osx-git-installer:
code.google.com/p/git-osx-installer/
12. Installing Git the Recommended Way:
# GPG (if you didn't have it already)
curl ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-
1.4.7.tar.bz2 tar xj
cd gnupg-1.4.7
./configure
make
sudo make install
cd ..
# GetText
curl http://mirrors.usc.edu/pub/gnu/gettext/gettext-
0.17.tar.gz tar xz
cd gettext-0.17
./configure
make
sudo make install
cd ..
13. Installing Git the Recommended Way:
# GIT
curl http://kernel.org/pub/software/scm/git/git-
1.5.5.tar.bz2 tar xj
cd git-1.5.5
./configure
make
sudo make install
cd ..
curl http://www.kernel.org/pub/software/scm/git/git-
manpages-1.5.5.tar.bz2
sudo tar xj -C /usr/local/share/man
18. $ git
usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]
[-p|--paginate|--no-pager] [--no-replace-objects]
[--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
[-c name=value] [--help]
COMMAND [ARGS]
The most commonly used git commands are:
add Add file contents to the index
bisect Find by binary search the change that introduced a bug
branch List, create, or delete branches
checkout Checkout a branch or paths to the working tree
clone Clone a repository into a new directory
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
fetch Download objects and refs from another repository
grep Print lines matching a pattern
init Create an empty git repository or reinitialize an existing one
log Show commit logs
merge Join two or more development histories together
mv Move or rename a file, a directory, or a symlink
pull Fetch from and merge with another repository or a local branch
push Update remote refs along with associated objects
rebase Forward-port local commits to the updated upstream head
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index
show Show various types of objects
status Show the working tree status
tag Create, list, delete or verify a tag object signed with GPG
22. WORKING WITH REMOTES
$ git remote add origin
git@host:repo-name.git
$ git remote add origin
forest@git.drupal.org
:sandbox/forest/project.git
$ git remote add github
git@github.com:forestmars/example.g
it
$ git remote -v
23. (What if I need to make my
repo bare later?)
$ git config --bool core.bare true
24. Quite possibly the most
useful slide in this deck
$ git describe
$ git status
$ git ls-files
$ git diff
$ git log --since=2.weeks
$ git foo –help
25. Wait I was wrong, this is the
really important one:
$ git commit --ammend
$ git checkout HEAD some_file
$ git revert HEAD^
$ git revert HEAD~1 -m 1
$ git reset --hard HEAD
$ git reset --hard [reflog-id]
26. DON'T LOSE YOUR HEAD
$ git checkout HEAD
$ git reset --hard HEAD
27. IN EVENT OF CATASTROPHIC FAILURE (or where's the
Undo-Undo button?)
[forest@githubris gtfo (master)]$ git add somefile
[forest@githubris gtfo (master)]$ git commit -m "updated some file"
[master 7ff5b1e] updated some file
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 somefile
[forest@githubris gtfo (master)]$ cat somefile
contents of somefile
[forest@githubris gtfo (master)]$ git reset --hard HEAD^
HEAD is now at 15dae3b somefile
[forest@githubris gtfo (master)]$ cat somefile
cat: otherfile: No such file or directory
[forest@baird gtfo (master)]$ git reflog
15dae3b HEAD@{0}: HEAD^: updating HEAD
7ff5b1e HEAD@{1}: commit: updated some file
[forest@githubris gtfo (master)]$ git reset --hard 7ff5b1e
HEAD is now at 7ff5b1e updated some file
[forest@githubris gtfo (master)]$ cat somefile
39. $ git branch
* master
new_feature
$ git merge new_feature
$ git branch new_branch
$ git rebase
$ git pull --rebase
$ git rebase -i
$ git rebase
40. PUSH ME PULL YOU
$ git push
$ git push origin master
$ git push origin [branch-name]
$ git push [remote-repo]
LOCALBRANCHNAME:REMOTEBRANCHNAME
default behavior of git is to push matching refs,
so git push <remote-repo> would not push branch if it is not
present on <remote-repo>
$ git push -f –all
Once the local branch is pushed to the remote, execute:
$ git --set-upstream [local-branch] origin/[branch-name]
to make the local branch track the remote branch.
$ git push -n --dryrun
41. The Dirtiest Git Hack You Will Ever
See
$ git push upstream
upstreammaster:master
! [rejected] master -> master (non-
fast forward)
$ git push origin :master
$ git push origin master
47. $ git status
On branch master
Initial commit
Untracked files:
(use "git add <file>..." to include in
what will be committed)
1140078.info
my_awesome.module
nothing added to commit but untracked files
present (use "git add" to track)