Close

2022-06-14

Basic Git, GitHub Commands.

Basic Git, GitHub Commands.

Here are some of the basic Git and GitHub commands, along with a brief explanation of each:

  1. git clone: This command clones a repository from a remote server to your local machine. The syntax for this command is git clone <repository-url>.
  2. git init: This command initializes a new Git repository in your current working directory.
  3. git add: This command adds files to the staging area in preparation for a commit. The syntax for this command is git add <file-name>.
  4. git commit: This command is used to save changes to the local repository. The syntax for this command is git commit -m "commit message".
  5. 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 is git push origin <branch-name>.
  6. git pull: This command downloads changes from a remote repository to your local machine. The syntax for this command is git pull origin <branch-name>.
  7. git branch: This command is used to manage branches in Git. The syntax for creating a new branch is git branch <branch-name>.
  8. 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 is git checkout <branch-name>.
  9. git merge: This command combines changes from multiple branches into a single branch. The syntax for merging changes from one branch into another is git 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.