Git: Difference between revisions
Jump to navigation
Jump to search
| Line 1: | Line 1: | ||
=Using Git= | =Using Git= | ||
Here is a basic overview of how you can work with git@bitbucket: | Here is a basic overview of how you can work with git@bitbucket: | ||
Initialize git on your computer: | |||
<syntaxhighlight lang=bash> | |||
git config --global user.name "<your name>" | |||
git config --global user.email "<your emailaddress>" | |||
</syntaxhighlight> | |||
* Add your public key in your profile - 'Personal Settings' - 'SSH keys' | * Add your public key in your profile - 'Personal Settings' - 'SSH keys' | ||
| Line 25: | Line 31: | ||
* Open a "pull request" (propose changes to the master branch) | * Open a "pull request" (propose changes to the master branch) | ||
* "Merge" your branch to the master branch | * "Merge" your branch to the master branch | ||
=Other commands= | =Other commands= | ||
Revision as of 10:22, 12 January 2023
Using Git
Here is a basic overview of how you can work with git@bitbucket:
Initialize git on your computer:
git config --global user.name "<your name>"
git config --global user.email "<your emailaddress>"
- Add your public key in your profile - 'Personal Settings' - 'SSH keys'
Fresh project (nothing locally yet)
- Create a "repository" (project) with a git hosting tool (like Bitbucket)
git clone <Look under the Clone ButtonCopy (or clone) the repository to your local machinegit remote set-url --push origin <Look under the Clone Button>Set the push URLgit add <filenname>Add a file to your local repositorygit commit -m 'Reason for commit']git pushSend your changes to your master branch
For a project you have files for already
- Create a "repository" (project) with a git hosting tool (like Bitbucket)
git init(initialize the local repository)git add .(Add all file to the local repository)git commit -m 'Initial upload'git remote add origin <Look under the Clone Button>(Connect local to remote repository)git push -u origin --all(push all committed file to remote.
Other things you can do
- Create a "branch" (version), make a change, commit the change
- Open a "pull request" (propose changes to the master branch)
- "Merge" your branch to the master branch
Other commands
git config --local -l- List your configuration for this repository (in the current directory).
git remote -v- Show 'remote' configuration.
git status -v- Show all difference between the current directory and the local repository.
git add/rm <path>- Add or remove files from the list of files to be committed (local files will be removed too).
git commit -m 'Reason for commit'- Commit changes (add/rm) to the local repository.
git commit -a- Commit all local changes to the local repository.
git reset HEAD <path>- Reset commit status for <path>
git push- Send the repository remote<path>
git pull- Fetch all changes made remote<path>