Skip to content

somulo1/Learn-Git

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Conflicts, merging and rebasing

Merge Main into Greet Branch

a. Switch to Greet Branch:

git checkout Greet

b. Pull Latest Changes :

git pull origin main

c. and lastly merge main into Greet

git merge main

Switch to main branch and make changes to hello.sh file

a. Switch to Greet branch:

git checkout main

b. switch to the lib/ directory and make changes in hello.sh N/B you are in the parent directory :

cd work/hello/lib/

N/B if all the changes in this branch are not yet committed then commit and push the changes. you can even temporarily save your work when moving to another branch

git stash

and then stash them back when you get back to this branch

git stash apply

Merging Main into Greet Branch (Conflict)

a. Switch to Greet branch:

git checkout Greet

b. Attempt merge:

git merge main

Resolve the conflict (manually or using merge tools)

  1. Resolving Conflicts:

a. Open hello.sh in a text editor. b. Manually edit the file: check on incomming changes

  • Keep desired changes from each branch. c. Stage the resolved file:

    git add hello.sh

d. Commit the merge:

git commit -m "Resolved conflicts in hello.sh"

After resolving, stage the changes and commit

c. Stage the resolved file:

git add hello.sh

d. Commit the merge:

git commit -m "Resolved conflicts in hello.sh"

Rebasing Greet Branch

a. Switch to Greet branch:

git checkout Greet

b. Rebase onto main:

git rebase main

Merging Greet into Main

first Switch to main branch: and then carry out the merging process.

    git checkout main

Merge Greet:

git merge Greet

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published