GIT is popular distributed revision control system which is very helpful when multiple developers working on same project from different location. In this quick tutorial we will provide some GIT command which are very common on daily use of GIT.
I am also sharing steps to create branch and merge code with your master branch.You can find here often useful GIT command.
How to add file in branch 3>
git add file_path, second_file_path
How to commit file in branch
git commit file_path, second_file_path
ESC + I and type comment
ESC + : wq
How to push code in branch
git push origin branch_name
enter phrase pass key: like 12222
How to remove file from branch
git rm file_path
How to change branch
git checkout –f branch_name
How to create branch
i will share command to create branch on GIT. GIT branch is a copy of master branch that’s mean if you want create new features/fix bug in your project, you just create a branch and pushed this on master when you tested ok, that’s mean your master branch is tested working copy of your project.
make sure Before creating a new branch pull the changes from upstream, your master needs to be up to date.
git checkout –f
git checkout 'branch_name'
git checkout pull
git checkout –b 'branch_name'
How to set branch permission on GIT
1- login as root user.
CHMOD -Rf 777 *
How to push code into GIT and merge with branch
Step 1: Login on the linux machine with your credential .
Step 2: Change directory to ‘/var/www/html/
Step 3: Check your banch
if it is not your branch switch to your banch
Step 4: Check the file difference with github
Step 5: Commit your files into the git hub
Step 6: Change the branch to QA
git checkout qa
Step 7: Update qa branch
Step 8: Switch to your branch
Step 9: Merge your branch with QA
git merge qa
Step 10: Push code to github
git push origin