- Initialize the project on the machine first and then add the remote from github
echo "# LearnGit by DuogBachDev" >> README.md
git init
git add .
git commit -m "Project_Initialization"
git remote add origin https://github.com/...
git push origin master
- Stand from master branch and then switch to new working branch
git checkout -b "New_Working_Branch"
- Add features or modify the code in the project
- Add all new code
git add .
- Generate commit code
git commit -m "First_Commit"
Note : If you have already committed with a commit name and want to modify that commit name, you can use the command
git commit --am -m "New_Commit_Name"
- For the repository that you own, just push straight to the main branch or the branch you switched to the new branch
git push origin "Branch_Name"
- Create a pull request & compare
- In case after you have created a pull request and you want to edit it, you need the next code, then use the command
git add .
git commit --amend
git push origin "Branch_Name" -f
- Merge pull request from master branch
git checkout "Master_Branch"
git pull origin "Master_Branch"
- Delete branch on github and local
1. Local :
git branch -D "Branch_Name"
2. Github :
Click the delete branch button on the github page
- Then go back to step 2 and continue for the project
Note : Note for corporate projects, depending on the company, if you are decentralized, you can merge the code, otherwise the leader will do this.
For example company name is : DuogBachDev
- Folk project on personal github
Click the folk button on the project's display page
- Clone folk project to my computer
git clone https://github.com/...
- Add master remote from company repository
git remote add "Company_Name" https://github.com/...
- Stand from master branch and then switch to new working branch
git checkout -b "New_Working_Branch"
- Add features or modify the code in the project
- Add all new code
git add .
- Generate commit code
git commit -m "First_Commit"
- You need to push commit to your personal remote, not your company remote
git push origin "Branch_Name"
- Open the company’s original repository and make a pull request
- In case after you have created a pull request and you want to edit it, you need the next code, then use the command
git add .
git commit --amend
git push origin "Branch_Name" -f
- Merge pull request from master branch
git checkout "Master_Branch"
git pull origin "Master_Branch"
- Delete branch on github and local
1. Local :
git branch -D "Branch_Name"
2. Github :
Click the delete branch button on the github page
- Then go back to step 2 and continue for the project
Note : Note for corporate projects, depending on the company, if you are decentralized, you can merge the code, otherwise the leader will do this.
git reflog --no-abbrev, cherry pick..v.v
If you want to be quick, just finish the code and push straight to the master branch for quick (≧∇≦)ノ
Author : DuogBachDev aka DuogBachDev
Portfolio : https://portfolio-duogbachdev.vercel.app/
DonateforMe : https://donate-duogbach.vercel.app/
“A bit of fragrance clings to the hand that gives flowers!”
Thanks for watching !