Eventdone Git Management: Basic Instructions
Eventdone Git Management: Basic Instructions
Basic Instructions:
There are three types of files in git:
1. Untracked (git doesn’t know about these files, each new file is an untracked file initially)
2. Unstaged (tracked but has some changes)
3. Staged (unstaged file added to staged, these files are committed when you make a new
commit)
Basic git commands:
- Clone the project (at very start)
git clone <repo url>
- Taking pull of a remote branch
git pull origin <branch-name> e.g. git pull origin master
- Creating a new branch
git branch <branch-name> e.g. git branch first-branch
- Checking out to a branch
git checkout <branch-name> e.g. git checkout first-branch
- Deleting a branch
git branch -D <branch-name> e.g. git branch -D first-branch
Hints:
- When writing a branch name, write its initial word(s) and press tab button and the branch
name will complete automatically.
Working on a new feature:
When you are going to start working on any new feature. You need to follow the following
steps. For example, you need to work on the ibox.
Create a new branch:
The git command for this is:
(It’s a normal convention mostly used in different projects. Its benefit is that you don’t need to
remember the branch name for future use, just remember the branch number which you can
also see from the sheet or card. )
Next Step:
At the end of each day commit your code to your branch. And push it to the origin. (optional)
Steps to commit:
Add the required files using
git commit -m ‘commit message’ (write a commit message according to your need)
Rebasing:
Work on that branch. After each 2-3 days period, rebase that branch with master branch.
Steps to Rebase:
git status
git stash (do this only if git status shows any files)
If this command executes successfully, you are good to go. But if it shows conflicts in an of the
files, first resolve those commits and then move ahead.
Resolve Conflicts:
git status (will show the files with conflicts in red, go to those files and resolve the
conflicts manually)
You may have to repeat the above two steps, if conflicts rises again.
git stash apply (If you previously executed git stash command)
When Done:
When the working on that branch is completed and it’s the time to merge the branch into
master branch. Follow the following steps:
- Rebase the branch with master branch (steps mentioned above)
- Merge the current branch into master branch (Steps to merge listed below)
- Push the master branch to the origin
- Delete that branch from your local (optional)
- Delete that particular branch from the DevOps
Merge Steps:
Note: The procedure is devised for initial experience, we can improve and modify it, depending
on its success and the issues faced.