Skip to content

Latest commit

 

History

23 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Step 1: Repository Setup

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 main

Step 2: Feature Branch

git 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 

Step 3: Merge Conflict

f1:

h (conflict)
Implement the login functionality
git add f1 
git commit -m "conflict problem"
git checkout development
git merge login-feature 

Description Description


Step 4: Merge Feature

#Delete the feature branch after merging
git branch -d login-feature 
# Deleted branch login-feature (was d8b6ca6).

Step 5: Release Feature

git checkout -b release

7.

git 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"

8.

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 release

9.

git 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-fix

10.

git 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

1. Explain what git stash does and when it is useful.

git stash saves your unfinished changes so you can do something else, like switch branches, without losing your work.

2. Use git stash to temporarily save uncommitted changes.

git stash

3. List and describe the stashed changes.

git stash list
git stash show stash@{0}

4. Restore stashed changes using the appropriate command.

git stash show stash@{0}

5. Apply and remove a specific stash.

git stash apply

6. Drop or clear all stashes from the stash list.

git stash pop

7. What happens when you use git stash pop vs git stash apply?

  • git stash apply: restores the stash but keep it in the list.
  • git stash pop: restores the stash and remove it from the list.

8. What is the purpose of git stash save "message"?

add a description to your stash.

9. How can you stash changes for specific files instead of the entire working directory?

git stash push f1 f2 f3 

10. How can you check which files were affected in a particular stash?

git stash show stash@{0}

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors