2007-06-06 10:52:40
Re:how to learn git?
(Score:5, Informative)
by Anonymous Coward on Saturday June 02 2007, @11:28PM (#19368025)
cd project
git init
git add .
git commit -a -m "Initial commit"
vi file.php
git commit -a
vi new.php
git add new.php
git commit -a
git log
git branch working
git checkout working
git checkout -b working
vi file.php
git status
git commit -a
git branch
git checkout master
vi other.php
git commit -a
git merge working
gitk --all
git log master..working
HEAD^.. we are "popping" one commit)
git reset --hard HEAD^
"incoming" branch)
git push foo.bar.com:~/myrepo master:incoming
branch)
git pull baz.bar.com:~/otherrepo feature1
branch
git checkout working
git rebase master
It can get a LOT more complex of course.
When you're starting out, just remember "git commit -a" and you'll be fine.
Also check out "git reflog" to see the linear history of your repo. The pulling
/pushing stuff can get a lot more complex but it's damn powerful. If you can
figure out Arch (yeesh) you can figure out git!
SLASHDOT SEZ: you have too few characters per line. Okay, slashdot, here's part
of the man page for git-rebase:
If is specified, git-rebase will perform an automatic git checkout before doing
anything else. Otherwise it remains on the current branch. All changes made by
commits in the current branch but that are not in are saved to a temporary
area. This is the same set of commits that would be shown by git log ..HEAD.
The current branch is reset to , or if the --onto option was supplied. This has
the exact same effect as git reset --hard (or ).If is specified, git-rebase
will perform an automatic git checkout before doing anything else. Otherwise it
remains on the current branch. All changes made by commits in the current
branch but that are not in are saved to a temporary area. This is the same set
of commits that would be shown by git log ..HEAD. The current branch is reset
to , or if the --onto option was supplied. This has the exact same effect as
git reset --hard (or ).If is specified, git-rebase will perform an automatic
git checkout before doing anything else. Otherwise it remains on the current
branch. All changes made by commits in the current branch but that are not in
are saved to a temporary area. This is the same set of commits that would be
shown by git log ..HEAD. The current branch is reset to , or if the --onto
option was supplied. This has the exact same effect as git reset --hard (or ).