Simple Guide to Team Git Collaboration
Simple Guide to Team Git Collaboration
Note: install necessary modules if required with below command after clone .
❖ npm install
After cloning, the default branch (usually main) is checked out. Team members can confirm
all branches are available:
Create a Personal Branch: Create a personal branch from the team branch for your
task:
Work on the given Feature , Make changes to the assigned files & Test locally.
Once after you completed the task , Stage and commit your changes:
1.
2.
3.
Example:remote-delete
Syncing Before Starting New Work:
Repeat the steps 😁
1. Switch to the team branch or main (to get latest code in that particular branch )
2. Pull the latest change
3. Stage changes
4. Commit changes
5. Push branch
6. Solve the conflicts and create pull request
Action Command
Use Case:
Steps:
1.Stash Your Changes:This saves your uncommitted changes and leaves the working
directory clean.
3.Fix the Bug and Commit:Make changes or solve the bug and commit
4.Switch Back and Restore Your Changes : This restores your stashed changes
and removes them from the stash stack
Advanced Use Cases :
➔ Stash Specific Files :To stash specific files instead of all changes:
❖ git stash push -m "Stashing specific files" <file1> <file2>
➔ Stashing Untracked Files :By default, untracked files are not stashed.
To include them
❖ git stash -u
➔ Stashing with a Message:Add a descriptive message to your stash
entry:
❖ git stash save "WIP: Working on the login page"
➔ Applying a Specific Stash: To apply a specific stash from the list:
1. git stash list
Example output:
Command Description
git stash Stashes all uncommitted changes and clears the
working directory.
git stash pop Applies the latest stash and removes it from the
stash stack.
git stash drop Deletes a specific stash entry from the stash
stack.
git stash clear Clears all stashed entries from the stack.
git stash branch <branch> Creates a new branch and applies the latest
stash to it.
Pavankumar P
Follow for More Tech and AI Tips