Basic Git, GitHub Commands.
Here are some of the basic Git and GitHub commands, along with a brief explanation of each:
git clone
: This command clones a repository from a remote server to your local machine. The syntax for this command isgit clone <repository-url>
.git init
: This command initializes a new Git repository in your current working directory.git add
: This command adds files to the staging area in preparation for a commit. The syntax for this command isgit add <file-name>
.git commit
: This command is used to save changes to the local repository. The syntax for this command isgit commit -m "commit message"
.git push
: This command is used to upload changes from your local repository to a remote repository on a server, such as GitHub. The syntax for this command isgit push origin <branch-name>
.git pull
: This command downloads changes from a remote repository to your local machine. The syntax for this command isgit pull origin <branch-name>
.git branch
: This command is used to manage branches in Git. The syntax for creating a new branch isgit branch <branch-name>
.git checkout
: This command is used to switch between branches or to restore files in your working directory to a specific version. The syntax for switching to a different branch isgit checkout <branch-name>
.git merge
: This command combines changes from multiple branches into a single branch. The syntax for merging changes from one branch into another isgit merge <branch-name>
.
These are just a few basic Git and GitHub commands, but they should provide a good starting point for anyone new to version control and collaboration.