git init # initialize git repository
git branch -m main # rename master branch
git checkout -b development # create and switch to development branch
echo "hi" > f1 # create f1
git add f1
git commit -m "f1 added to development"
git checkout main # switch to main branch
git merge development # merge development into maingit checkout development
git checkout -b login-feature # create and switch to new feature branch
echo "Implement the login functionality" >> f1 # Add 'Implement the login functionality' in f1
# Commit and push changes to the feature branch
git add f1
git commit -m "login feature added to f1"
git remote add origin https://github.com/abeerseada/git-task1.git
git push origin login-feature f1:
h (conflict)
Implement the login functionality
git add f1
git commit -m "conflict problem"
git checkout development
git merge login-feature #Delete the feature branch after merging
git branch -d login-feature
# Deleted branch login-feature (was d8b6ca6).git checkout -b releasegit checkout login-feature
echo "Case 1" >> f1
git add f1
git commit -m "Add Case 1 in f1"
echo "Case 2" >> f1
git add f1
git commit -m "Add Case 2 in f1"
echo "Case 3" >> f1
git add f1
git commit -m "Add Case 3 in f1"git checkout release
git log login-feature
git cherry-pick 121a8af117 03f713465
git checkout main
git merge release
git checkout development
git merge release
git branch -d releasegit checkout main
git checkout -b hotfix
git add f1
git commit -m "Fix security issue in login system"
git checkout development
git merge hotfix
git branch -d hotfix/security-fixgit checkout development
git log development
git rebase -i 971dd1eee^
Task 2:
You are working on a new feature but need to switch branches to fix a bug. You haven't committed your changes yet and don't want to lose them.
Task Steps
git stash saves your unfinished changes so you can do something else, like switch branches, without losing your work.
git stashgit stash list
git stash show stash@{0}git stash show stash@{0}git stash applygit stash popgit stash apply: restores the stash but keep it in the list.git stash pop: restores the stash and remove it from the list.
add a description to your stash.
git stash push f1 f2 f3 git stash show stash@{0}
