DEV Community

FatimaAlam1234
FatimaAlam1234

Posted on

GitHub - Commit, Pull Request, Merge

To clone repository on local system ->

git clone <repository-url>
Enter fullscreen mode Exit fullscreen mode

Get inside the local repo branch
Check which branch you are in and all current branches available on local system ->

git branch
Enter fullscreen mode Exit fullscreen mode

If required branch not found, get all current branches from GitHub ->

git fetch
Enter fullscreen mode Exit fullscreen mode

.
To get into a different branch ->

git checkout <that-branch-url>
Enter fullscreen mode Exit fullscreen mode

To check changes in current branch ->

git status
Enter fullscreen mode Exit fullscreen mode

To add changes to stage ->

git add <files-to-be-staged>
Enter fullscreen mode Exit fullscreen mode

To commit those changes ->

git commit -m "message"
Enter fullscreen mode Exit fullscreen mode

.
To push those changes in that branch ->

git push
Enter fullscreen mode Exit fullscreen mode

To merge it in main branch (or any branch) -> create pull request from that branch.
Go to the branch requested and accept that merge request

Top comments (0)