Skip to content

kmr200/GitRedo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Step 1:

git checkout git_1
touch firstFile.txt
SCR-20240819-umzk
git add firstFile.txt
git commit -m "New file: firstFile.txt"

Step 2:

touch secondFile.txt
SCR-20240819-unzs
git add secondFile.txt
git commit -m "New fiel: secondFile.txt"

Step 3:

git checkout git_2
git merge git_1
SCR-20240819-upkf

Step 4:

SCR-20240819-uqac
git commit -a -m "Modified secondFile"

Step 5:

SCR-20240819-uqvb
git commit -a -m "Edited secondFile"

Step 6:

git merge git_2 --no-ff
SCR-20240820-baej SCR-20240820-balb

After resolving the conflict and leaving all 4 lines:

SCR-20240820-bavc
git commit -a -m "Resolved conflict"
SCR-20240820-bbix

Step 7:

SCR-20240820-bbyr
git commit -a -m "Modified firstFile"

Step 8:

SCR-20240820-bclz
git commit -a -m "Edited firstFile"

Step 9:

Taking the hash of the commit to be transfered:

git log
SCR-20240820-bhhw

Then we create the patch file:

SCR-20240820-bikz

Then we apply it in git_2:

git checkout git_2
git am 0001-Modified-firstFile.patch

Results:

SCR-20240820-biyr

Step 10:

First we need the hash of the commit:

SCR-20240820-bjdf

Then we apply it in git_2:

SCR-20240820-bjpc

Step 11:

For this purpose we will move HEAD pointer up by 2 commits using command:

git reset --soft "HEAD^^"

Soft mode ensures that all the changes remain. And then we make a new commit:

git commit -a -m "Concatinating the last two commits"

Result:

SCR-20240820-blrt

Step 12:

We will use git commit --amend command:

SCR-20240820-bmok

Step 13:

SCR-20240820-bndv

Step 14:

SCR-20240820-bnnf

Step 15:

git reset --hard HEAD^^
SCR-20240820-bnxc

Step 16:

SCR-20240820-bogz

Step 17:

SCR-20240820-boug

Step 18:

Edited firstFile from folder2:

SCR-20240820-bpec SCR-20240820-bqni

Step 19:

Edited firstFile from folder1:

SCR-20240820-bpvb

Prepare for Step 20:

git stash

Step 20:

SCR-20240820-bsdn

git pull origin git_1

This is how firstFile looks now:

SCR-20240820-bunr

Pushing:

SCR-20240820-buvl

Conflict while stashing:

SCR-20240820-bwct

Handling conflicts:

SCR-20240820-bwjw

I'm going to leave only the stashed changes:

SCR-20240820-bwpl

Result:

SCR-20240820-bxoi

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published