Skip to content

Instantly share code, notes, and snippets.

View jgeewax's full-sized avatar
🤯
Learning

JJ Geewax jgeewax

🤯
Learning
View GitHub Profile
# This is a combination of 4 commits.
# The first commit's message is:
Added feature
# This is the 2nd commit message:
Removed the README file
# This is the 3rd commit message:
Issue 12 - Added new feature XYZ
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# Not currently on any branch.
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# deleted: README.txt
# new file: feature.py
(issue-12)jj@im-jj:~/demo$ git checkout master
Switched to branch 'master'
(master)jj@im-jj:~/demo$ echo "there was a typo" >> fixed_typo.txt
(master)jj@im-jj:~/demo$ git add fixed_typo.txt
(master)jj@im-jj:~/demo$ git commit -m "Added fixed typo"
[master c348893] Added fixed typo
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 fixed_typo.txt
(master)jj@im-jj:~/demo$
(master)jj@im-jj:~/demo$ git checkout issue-12
Switched to branch 'issue-12'
(issue-12)jj@im-jj:~/demo$ git rebase master
First, rewinding head to replay your work on top of it...
Applying: Issue 12 - Added new feature XYZ
(issue-12)jj@im-jj:~/demo$ git checkout master
Switched to branch 'master'
Your branch is ahead of 'origin/master' by 1 commit. # <-- Always be 1 commit ahead.
(master)jj@im-jj:~/demo$ git merge issue-12
Updating c348893..d0e9912
Fast forward
feature.py | 3 +++
testfile.txt | 1 +
2 files changed, 4 insertions(+), 0 deletions(-)
delete mode 100644 README.txt
(master)jj@im-jj:~/demo$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 2 commits. # <-- 1 for issue-12, 1 for the typo-fix.
#
nothing to commit (working directory clean)
(master)jj@im-jj:~/demo$ git remote show origin
* remote origin
URL: my-server:/git/demo.git
HEAD branch: master
Remote branch:
(master)jj@im-jj:~/demo$ git push origin
Counting objects: 8, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (7/7), 699 bytes, done.
Total 7 (delta 0), reused 0 (delta 0)
To my-server:/git/demo.git
309291d..d0e9912 HEAD -> master
(master)jj@im-jj:~/demo$ git branch -d issue-12
Deleted branch issue-12 (was d0e9912).
(issue-12)jj@im-jj:~/demo$ git rebase master
First, rewinding head to replay your work on top of it...
Applying: Issue 12 - Added new feature XYZ
(master)jj@im-jj:~/demo$ git checkout -b rc-1.0
Switched to a new branch 'rc-1.0'
(rc-1.0)jj@im-jj:~/demo$ git push origin rc-1.0
Total 0 (delta 0), reused 0 (delta 0)
To my-server:/git/demo.git
* [new branch] rc-1.0 -> rc-1.0
(rc-1.0)jj@im-jj:~/demo$ git remote show origin
* remote origin
URL: my-server:/git/demo.git
HEAD branch (remote HEAD is ambiguous, may be one of the following):