Git vs GitHub !!!
Something known about git vs github..
We know about that these days git is a powerful tool for developer and this is also useful to control the project version. Git is allow us to maintain project structure and developer can easily work independently without affecting the main codebase.
Git also provide us some command to do these type of work and all have a different meaning related to this. It integrates with Git, which is a distributed version control system. GitHub itself offers a variety of commands and features for managing repositories, issues, pull requests, and more. Here’s a rundown of commonly used commands in GitHub
Git Commands
Configuration
- Git config:- this will show you all the related git config on your local machine, which was set by you earlier. “Git config” have some sub-arguments and you can see that by “git help”.
- Git config —global:- within this command you are going to set the all configuration of git globally and you can as like “git config —list”
Repository Management
- git init:- “Git init” will give you initialisation on current working directory for git repository. When you apply this command then you can know that, this is my new repository where I initialised the working directory.
- Git clone <repo_url>:- this command help you to create a new repository by cloning the new repository for work. And this will create on your local machine, where you clone that repo-url.
- Git status:- this is another useful command in git and this will help you to know that where am I currently, according to this status you can go ahead and do your work accordingly.
- Git add:- “Git Add” is a command of git which help you to add all the modified, added and deleted file to the new stage which would be “Commit” stage.
- Git commit -m “your message”:- this command will help you to commit the change, which you done on your local machine.
- Git pull:- This will help you to fetch and integrate the change to your current branch, so that your branch will up-to-date with latest codebase.
- Git push:- whenever you have done your change and you have been done to commit stage then you can upload your change to your branch over-there you can you this command to push your code to the remote branch.
- Git branch:- git branch will help you to show all the local branch which is available on your local machine.
- Git branch <branch-name>:- if you want to create a new branch on your local machine then you can hit this command by your new branch name and you will get the new branch.
- Git checkout <branch-name>:- this command will help you in change your branch if branch not available then this command will create a branch and then checkout in that branch.
- Git merge <branch-name>:- it will merge the codebase of called branch to the your current branch.
- Git fetch:- git fetch is useful command this will help you to fetch all the repository from remote and you can see all the remote repository to your local machine. Retrieves changes from the remote repository but doesn’t integrate them.
- Git rebase <branch-name>:- Applies changes from one branch onto another, effectively integrating changes.
- Git reset:- “git reset” your current branch to specific state, optionally modifying the working directory and staging area.
- Git log:- git log is useful command and this will help you to show all the logs which you apply to commit state. Simply show the commit history of git.
- Git diff:- git diff will you for know the difference of modified of files. This will display you difference between changes.
GitHub Commands
Issues and Pull Requests (via github CLI)
- gh repo create <repo-name>:- this will create your repository over the remote with give repo-name.
- gh repo clone <repo>:- this command will help you to clone the GitHub repository using the GitHub CLI.
- gh issue create:- this will create issues on your current repository if approval find any issue in the repository and again assign to you to solve that issue.
- gh issue list:- this will help you to know the all issue within current repository.
- gh issue view <issue-number>:- this command is useful to see the details of particular issue by the issue-number.
- gh pr create:- when your work has been done and now you don’t need to change anything in your codebase then you are raised a PR (pull request) to merge all the changes on your main either master branch so that you will go to use this command to create PR.
- gh pr list:- if PR approval want to see the all PR list to the particular repository then he can easily apply this command and see the result related that one.
- gh pr view <pr-number>:- if you want to see the details of the particular pull request (PR) then you can use this command.
- gh pr merge <pr-number>:- if everything is okay and will not affect to the main branch in negative then approval can apply this command by the PR-NUMBER and merge the code on main codebase.
- gh repo view <repo-name>:- if you want to see the details of repository then you can use this command and this is helpful to know the details of particular repository.
Github Actions
- gh run list:- this will show you all the Lists workflow runs for the current repository.
- gh run view <run-id>:- this will give you details view of particular run-id. Displays details about a specific workflow run.
Github Actions Workflow
- gh actions status:- this command is useful when you need to know and want to see the actions workflow status then you can use this command.
- gh actions run:- manually trigger a workflow.
These commands and tools enable a wide range of activities, from basic version control to advanced project management and automation on GitHub. You can know about the differences.