Git commands
If you've just started using Git, you may need to refer to this page a few times before you get the hang of using them from the command line.
Task | Git commands |
---|---|
Create a new local directory: |
|
Connect your local repository to a remote server: |
|
Copy a remote repository to your local system: |
|
Add a specific file to staging (Git) or after a new file is created (Hg): |
|
Add all changes to staging (Git) or all new files (Hg): |
|
Commit changes locally: |
|
Push changes to your remote repository: |
usually: |
List the status of the files you've changed and those you still need to add or commit: |
|
Create a new branch (Git) or bookmark (Hg) and switch to it: |
|
Switch from one branch or bookmark to another: |
|
List all the branches/bookmarks in your repo with an indication of the one you are on: |
|
Delete the feature branch/bookmark: |
|
Push the branch/bookmark to your remote repository: |
|
Fetch and merge changes on the remote server to your working directory: |
|
Merge two different revisions into one: |
|
Show all changes made since the last commit: |
|
For more commands, check out Bitbucket Data Center's Basic Git commands and the Git cheat sheet.
Was this helpful?