You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Initialize Git repository, CHDIR into its top-level directory
% git init branching
Initialized empty Git repository in /home/drbitboy/tmp/branching/.git/
% cd branching
Create new python script that prints Greatest Generation members
% vi family_.py
% cat family_.py
"""
Frank Conley
Marilyn Bush
John Carcich
Catherine Rerecich
"""
if "__main__" == __name__:
for fammember in __doc__.strip().split('\n'):
print(fammember)
Exercise that script
% python family_.py
Frank Conley
Marilyn Bush
John Carcich
Catherine Rerecich
Add and commit that script to this currentmaster branch as the initial commit
Make, and checkout, a new branch that is a copy of that current master branch
New branch name is next_gen
% git checkout -b next_gen
Switched to a new branch 'next_gen'
Show branches and log
Asterisk is next to HEAD (current checked-out branch, next_gen)
% git branch
master
* next_gen
% git log
commit f27ab44dbcfd06a3f08a1f27611e08baf0e85a12 (HEAD -> next_gen, master)
Author: Brian Carcich <briantcarcich@gmail.com>
Date: Sun Jun 15 08:27:55 2025 -0400
initial.commit
Edit script to add Boomers, show edited content, run script
% vi family_.py
% cat family_.py
"""
Frank Conley
Marilyn Bush
John Carcich
Catherine Rerecich
Jessica Conley
Brian Carcich
"""
if "__main__" == __name__:
for fammember in __doc__.strip().split('\n'):
print(fammember)
% python family_.py
Frank Conley
Marilyn Bush
John Carcich
Catherine Rerecich
Jessica Conley
Brian Carcich
Add, and then commit, updated script to currentnext_gen branch, then show log
Note that only the next_gen name is associated with the new commit hash 03c0622...
The master branch is unchanged
The branch name master is still associated with commit hash f27ab44...
% git add family_.py
% git commit -m "1956 additions"
[next_gen 03c0622] 1956 additions
1 file changed, 2 insertions(+)
% git log
commit 03c06228c8cd280ebb94cc49df6e8de1faea1122 (HEAD -> next_gen)
Author: Brian Carcich <briantcarcich@gmail.com>
Date: Sun Jun 15 08:29:06 2025 -0400
1956 additions
commit f27ab44dbcfd06a3f08a1f27611e08baf0e85a12 (master)
Author: Brian Carcich <briantcarcich@gmail.com>
Date: Sun Jun 15 08:27:55 2025 -0400
initial.commit
Edit script to add Millenials, run script
% vi family_.py
% python family_.py
Frank Conley
Marilyn Bush
John Carcich
Catherine Rerecich
Jessica Conley
Brian Carcich
Gemma Carcich
Benjamin Anible
Benjamin Carcich
Laura Lohberger
Daniel Carcich
Alexandra Carcich
Add, and then commit, updated script to currentnext_gen branch, then show log
% git add family_.py
% git commit -m "1980s additions"
[next_gen cbfb227] 1980s additions
1 file changed, 6 insertions(+)
% git log
commit cbfb227431a4523dc4d40447315241aec926329b (HEAD -> next_gen)
Author: Brian Carcich <briantcarcich@gmail.com>
Date: Sun Jun 15 08:30:41 2025 -0400
1980s additions
commit 03c06228c8cd280ebb94cc49df6e8de1faea1122
Author: Brian Carcich <briantcarcich@gmail.com>
Date: Sun Jun 15 08:29:06 2025 -0400
1956 additions
commit f27ab44dbcfd06a3f08a1f27611e08baf0e85a12 (master)
Author: Brian Carcich <briantcarcich@gmail.com>
Date: Sun Jun 15 08:27:55 2025 -0400
initial.commit
Edit script to add Kids, run script
% vi family_.py
% python family_.py
Frank Conley
Marilyn Bush
John Carcich
Catherine Rerecich
Jessica Conley
Brian Carcich
Gemma Carcich
Benjamin Anible
Benjamin Carcich
Laura Lohberger
Daniel Carcich
Alexandra Carcich
Georgi Carcich
Violet Carcich
Naomi Carcich
Add, and then commit, updated script to currentnext_gen branch, then show log
% git add family_.py
% git commit -m "great grandchildren"
[next_gen 73ebd47] great grandchildren
1 file changed, 3 insertions(+)
% git log
commit 73ebd470a4108c0e0b37a2db3b65a4cf1cb5da95 (HEAD -> next_gen)
Author: Brian Carcich <briantcarcich@gmail.com>
Date: Sun Jun 15 08:31:51 2025 -0400
great grandchildren
commit cbfb227431a4523dc4d40447315241aec926329b
Author: Brian Carcich <briantcarcich@gmail.com>
Date: Sun Jun 15 08:30:41 2025 -0400
1980s additions
commit 03c06228c8cd280ebb94cc49df6e8de1faea1122
Author: Brian Carcich <briantcarcich@gmail.com>
Date: Sun Jun 15 08:29:06 2025 -0400
1956 additions
commit f27ab44dbcfd06a3f08a1f27611e08baf0e85a12 (master)
Author: Brian Carcich <briantcarcich@gmail.com>
Date: Sun Jun 15 08:27:55 2025 -0400
initial.commit
Checkout master branch, then merge next_gen branch into it
% git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
% git merge next_gen
Auto-merging family_.py
Merge made by the 'recursive' strategy.
README.md | 384 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
family_.py | 11 +++
2 files changed, 395 insertions(+)
create mode 100644 README.md
Show --oneline --graph log
Graph display illustrates how branches have been merged