- Git snippets
- Create a new repo
- Clone new repo
- Add & commit local files to remote repo
- Connect your (new) local repo with existing online-repo
- Discharge local changes and pull and overwrite things from git
- Discharge local branch and reset to remote head
- Switch off gpg signing
- Change Username and E-Mail
- Add new branch
- Clone a specific branch only
- New tag
- Archive a branch
- Get current repo url
- New repo-url to existing local repo
- Sync local tags with remote (this overwrites local tags)
- Solve
push declined due to email privacy restrictions
error
git init
git clone /path/to/repository
## OR:
git clone username@host:/path/to/repository
Add changes to staging area
git add file.c
If you want to add all files in one rush, run:
git add .
Then, if you added the file(s), run
git commit -m "Commit-Message"
to put the files to the git HEAD. To finally push the files to the remote repo, run:
git push origin branch_name
git init
git remote add origin <server>
git checkout filename.xyz
git pull
git fetch origin
git reset --hard origin/master
git config --global commit.gpgsign false
git config user.name "new_username"
git config user.email "[email protected]"
git checkout -b name_of_new_branch
git push origin name_of_new_branch
git clone --single-branch --branch BRANCHNAME REPO_URL
-
Add, commit and push new stuff
-
If you want to replace an existing tag, delete the local tag:
git tag -d v0.0.6
-
Push deleted tag:
git push -d origin v0.0.6
-
New local tag:
git tag -a v0.0.6 -m "release v0.0.6"
-
Push local tag
git push origin v0.0.6
-
Merge the new date/state to all necessary branches
## Merge the status of the development branch into the master: git checkout master git merge development git push ## Merge the (new) status of the master branch also into the latest branch: git checkout latest git merge master git push origin latest
git tag archive/BRANCHNAME BRANCHNAME
git branch -d BRANCHNAME
git checkout master
git remote get-url --all origin
git remote set-url origin https://git.company.com/path/to/your-project.git
git tag
git fetch --prune-tags -f
git tag
To get your anonymous E-Mail address, read this answer on Stackoverflow: https://stackoverflow.com/a/44099011/13890903
git config user.email {ID}+{username}@users.noreply.github.com
git commit --amend --reset-author
git push