Sunday, 31 October 2021

 

Common Git Commands

 

Take clone of a repository
git clone <remote-repository-url>
 
Create a branch
The branch should always be created from dev branch, for that you need to first checkout to dev branch by the following command
  • git checkout dev
  • git pull origin dev
then create the branch
  • git checkout -b <branch-name>
ex: git checkout -b feature/regtech-533
Here feature notifies that this branch is created for a feature. Similarly for creating a branch for a bug the branch name will be like bug/regtech-113
 
To see the current branch
git branch
 
To see all the branches in a repository
git branch -a
 
Pull from a branch
git pull <branch-name>
git pull origin feature/regtech-533
 
To see the status
git status
 
To see the differences made
git diff
 
staging a file or folder
git add <file or folder name>
ex: git add index.ts
 
committing the changes
git commit -m "message"
ex: git commit -m "Changes made for feature regtech-533"
 
To push the code to repository
git push origin <branch-name>
ex: git push origin feature/regtech-533
 
For Creating a pull request
After pushing the code to the repository
go to github.com repository page
Click on the contribute button below the code and press the open pull request button

  Common Git Commands   Take clone of a repository git clone <remote-repository-url> ex: git clone  https://github.com/agricor/RegTech...