git checkout Feature1
# make sure current checking-out branch is Feature1
git branch
edit the file test5
git add, git commit, no push yet
## making sure working on Feature1 branch
git branch
git add test5
git commit -m "Feature1: edited the file test5"
The project history in EGit becomes like (Feature1's head moved forward, 1 commit ahead master ):
Step3: master branch: no change
do nothing in this step
Step4: checking out master branch, merge Feature1 branch back
# make sure on master branch
git checkout master
git branch
# merge
git merge Feature1
As we can see, before merging, Feature1 branch is 1 commit ahead master branch:
When the developer merge, it is a fast-forward merging, and the master branch head move 1 commit forward, pointing to the same commit as Feature1 branch:
Step5: Looking into details about the commits happened during the whole test
the start point commit
the edit-test5-commit (did when checking out Feature1 branch)
Merging --> no commit or history recorded about merging
Step6: history in github before vs. after git push origin master
For now, the developer hasn't pushed the test5 edit commit to remote repo, the latest commit on Github is:
--> master branch:
--> Feature1 branch: ( no Feature1 branch on remote repo yet because the developer hasn't set up it to be remote-tracking one )
Now, if the developer git push commits to master branch to the remote repo:
The two commits will show up on github - master branch
However, the branch Feature1 is still not on github
Cloned the repo, work on two branches
Scenario abstraction
Feature1 branch
andmaster branch
of the repo) (Feature1 branch
was derived frommaster branch
):master
branchFeature1
branchFeature1
branch, editedtest5
file, add, commit;master
branch, no change, no commit;master
branch, mergeFeature1
branch;push
all changes back to remote repo)Results:
head
pointerData could be explored:
Detailed steps
step0: start point of the test case:
test5
onmaster
branchgit checkout master
touch test5
test5
git branch Feature1
preparation done.Creating branch and checking out
Feature1
, it also has the filetest5
, the version is the same asmaster
branch.Startpoint preparation finished.
The
master
branchhead
andFeature1
branch point to the same commit, and the project log looks like:Step1: cloned the repo ( already did in testcase #1 )
To make it short, we call them:
Step2:
Feature1
branch: edited filetest5
, committedchecking out
Feature1
branchedit the file
test5
The project history in EGit becomes like (
Feature1
's head moved forward, 1 commit aheadmaster
):Step3:
master
branch: no changedo nothing in this step
Step4: checking out
master
branch, mergeFeature1
branch backAs we can see, before merging,
Feature1
branch is 1 commit aheadmaster
branch:When the developer
merge
, it is afast-forward merging
, and themaster
branchhead
move 1 commit forward, pointing to the same commit asFeature1
branch:Step5: Looking into details about the commits happened during the whole test
Feature1
branch)Step6: history in github before vs. after
git push origin master
For now, the developer hasn't pushed the test5 edit commit to remote repo, the latest commit on Github is:
-->
master
branch:-->
Feature1
branch: ( noFeature1
branch on remote repo yet because the developer hasn't set up it to be remote-tracking one )Now, if the developer
git push
commits tomaster
branch to the remote repo: The two commits will show up ongithub
-master
branchHowever, the branch
Feature1
is still not ongithub
Step7: setup remote-tracking,
git push origin Feature1
Feature1
branchAs we can see, there is no remote-tracking branch of
Feature1
Feature1
branchAs we can see now, there is a
Feature1
branch on githubWhen looking into changes of
Feature1
branch:it has all the new commits in this test case, also all history commits of its parent branch --
master
branch.Conclusion: no history/data recorded for this case, nothing to exploit