8. #6 COMMIT
~/ancestry [master] $ touch new_file.rb
~/ancestry [master] $ git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what
will be committed)
#
# new_file.rb
nothing added to commit but untracked files
present (use "git add" to track)
9. #6 COMMIT
~/ancestry [master] $ git add .
~/ancestry [master] $ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: new_file.rb
#
~/ancestry [master] $ git commit -m "New file."
[master 248a8a4] New file.
0 files changed
create mode 100644 new_file.rb
10. #7 REBASE
~/ancestry [master] $ git fetch upstream
From git://github.com/stefankroes/ancestry
* [new branch] 1-3-stable -> upstream/1-3-stable
* [new branch] gh-pages -> upstream/gh-pages
* [new branch] master -> upstream/master
* [new branch] rails3 -> upstream/rails3
From git://github.com/stefankroes/ancestry
* branch master -> FETCH_HEAD
~/ancestry [master] $ git rebase upstream/master
master
Already on 'master'
Current branch master is up to date.
11. #8 PUSH
~/ancestry [master] $ git push origin master
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 284 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
To git@github.com:rodolfospalenza/ancestry.git
39f00ab..248a8a4 master -> master
14. #10 REBASE VS. PULL
USER 01
~/ancestry [master] $ git log --graph
* commit bbf1e7e177f0a86f635c41b6181f1694a71492ce
| Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com>
| Date: Tue Dec 11 21:52:47 2012 -0200
|
| Add new file.
|
* commit 39f00abbbca1e6e90b1a268e918342b6950812c5
| Author: Stefan Henzen <s.f.henzen@nedforce.nl>
| Date: Fri Jun 29 14:50:18 2012 +0200
|
| fix readme, small fix in restore_ancestry_integrity!
15. #10 REBASE VS. PULL
USER 01
~/ancestry [master] $ git push origin master
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 614 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
To git@github.com:rodolfospalenza/ancestry.git
39f00ab..bbf1e7e master -> master
16. #10 REBASE VS. PULL
USER 02
~/ancestry [master] $ git log --graph
* commit 5310b92074cde08673a622a476ee95edd98cd387
| Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com>
| Date: Tue Dec 11 21:52:47 2012 -0200
|
| Add old file.
|
* commit 39f00abbbca1e6e90b1a268e918342b6950812c5
| Author: Stefan Henzen <s.f.henzen@nedforce.nl>
| Date: Fri Jun 29 14:50:18 2012 +0200
|
| fix readme, small fix in restore_ancestry_integrity!
17. #10 REBASE VS. PULL
USER 02
~/ancestry [master] $ git push origin master
To git@github.com:rodolfospalenza/ancestry.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to
'git@github.com:rodolfospalenza/ancestry.git'
hint: Updates were rejected because the tip of your
current branch is behind
hint: its remote counterpart. Merge the remote changes
(e.g. 'git pull')
hint: before pushing again.
18. #10 REBASE VS. PULL
USER 02
~/ancestry [master] $ git pull origin master
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 1), reused 3 (delta 1)
Unpacking objects: 100% (3/3), done.
From github.com:rodolfospalenza/ancestry
* branch master -> FETCH_HEAD
Merge made by the 'recursive' strategy.
new_file | 1 +
1 file changed, 1 insertion(+)
create mode 100644 new_file
19. #10 REBASE VS. PULL
USER 02
~/ancestry [master] $ git log --graph
* commit 7a85d5c39575dec335a86ed936c2c6a949b51de0
| Merge: 5310b92 bbf1e7e
| | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com>
| | Date: Tue Dec 11 22:06:49 2012 -0200
| |
| | Merge branch 'master' of github.com:rodolfospalenza/ancestry
| |
| * commit bbf1e7e177f0a86f635c41b6181f1694a71492ce
| | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com>
| | Date: Tue Dec 11 21:52:47 2012 -0200
| |
| | Add new file.
| |
* | commit 5310b92074cde08673a622a476ee95edd98cd387
|/ Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com>
| Date: Tue Dec 11 22:02:54 2012 -0200
|
| Add old file.
|
* commit 39f00abbbca1e6e90b1a268e918342b6950812c5
| Author: Stefan Henzen <s.f.henzen@nedforce.nl>
| Date: Fri Jun 29 14:50:18 2012 +0200
|
| fix readme, small fix in restore_ancestry_integrity!
22. #10 REBASE VS. PULL
USER 02
~/ancestry [master] $ git fetch origin
From github.com:rodolfospalenza/ancestry
39f00ab..bbf1e7e master -> origin/
master
~/ancestry [master] $ git rebase origin/master master
First, rewinding head to replay your work on top of
it...
Applying: Add old file.
23. #10 REBASE VS. PULL
USER 02
~/ancestry [master] $ git log --graph
* commit c765729377be06ecba78e3dd110a66f348699475
| Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com>
| Date: Tue Dec 11 22:16:26 2012 -0200
|
| Add old file.
|
* commit bbf1e7e177f0a86f635c41b6181f1694a71492ce
| Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com>
| Date: Tue Dec 11 21:52:47 2012 -0200
|
| Add new file.
|
* commit 39f00abbbca1e6e90b1a268e918342b6950812c5
| Author: Stefan Henzen <s.f.henzen@nedforce.nl>
| Date: Fri Jun 29 14:50:18 2012 +0200
|
| fix readme, small fix in restore_ancestry_integrity!
24. #10 REBASE VS. PULL
USER 02
~/ancestry [master] $ git push origin master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 250 bytes, done.
Total 2 (delta 1), reused 0 (delta 0)
To git@github.com:rodolfospalenza/ancestry.git
bbf1e7e..c765729 master -> master
26. #11 AMENDED COMMIT
1 Add old file.
2
3 # Please enter the commit message for your changes.
Lines starting
4 # with '#' will be ignored, and an empty message
aborts the commit.
5 # On branch master
6 # Changes to be committed:
7 # (use "git reset HEAD^1 <file>..." to unstage)
8 #
9 # new file: old_file
10 #
29. #12 INTERACTIVE REBASE
1 pick bbf1e7e Add new file.
2 r e1dbf27 Add old file.
3 f 3c84646 Add example file.
4
5 # Rebase 39f00ab..3c84646 onto 39f00ab
6 #
7 # Commands:
8 # p, pick = use commit
9 # r, reword = use commit, but edit the commit message
10 # e, edit = use commit, but stop for amending
11 # s, squash = use commit, but meld into previous commit
12 # f, fixup = like "squash", but discard this commit's log message
13 # x, exec = run command (the rest of the line) using shell
14 #
15 # These lines can be re-ordered; they are executed from top to bottom.
16 #
17 # If you remove a line here THAT COMMIT WILL BE LOST.
18 # However, if you remove everything, the rebase will be aborted.
19 #
20 # Note that empty commits are commented out
30. #12 INTERACTIVE REBASE
1 Add old file with rebase.
2
3 # Please enter the commit message for your changes.
Lines starting
4 # with '#' will be ignored, and an empty message
aborts the commit.
5 # Not currently on any branch.
6 # You are currently editing a commit during a rebase.
7
8 # Changes to be committed:
9 # (use "git reset HEAD^1 <file>..." to unstage)
10 #
11 # new file: old_file
12 #
31. #12 INTERACTIVE REBASE
~/ancestry [master] $ git rebase –i HEAD~3
[detached HEAD e2afa36] Add old file with rebase.
1 file changed, 3 insertions(+)
create mode 100644 old_file
[detached HEAD 952118d] Add old file with rebase.
2 files changed, 4 insertions(+)
create mode 100644 example
create mode 100644 old_file
Successfully rebased and updated refs/heads/master.
32. #12 INTERACTIVE REBASE
~/ancestry [master] $ git log --graph
* commit 952118d7fb53a33040f50707053ee1499f0728b9
| Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com>
| Date: Tue Dec 11 22:16:26 2012 -0200
|
| Add old file with rebase.
|
* commit Tue Dec 11 21:52:47 2012 -0200
| Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com>
| Date: Tue Dec 11 22:16:26 2012 -0200
|
| Add new file.
|