Skip to content

Instantly share code, notes, and snippets.

@ansrivas
Last active August 9, 2018 13:26
Show Gist options
  • Select an option

  • Save ansrivas/4a7380e2e400b8e0dfb17398d16cbbc7 to your computer and use it in GitHub Desktop.

Select an option

Save ansrivas/4a7380e2e400b8e0dfb17398d16cbbc7 to your computer and use it in GitHub Desktop.
git remote add
Git global setup
git config --global user.name "Ankur Srivastava"
git config --global user.email "ankur.srivastava@recogizer.de"
Create a new repository
git clone git@gitlab.recogizer.net:PlatformOps/log-platform.git
cd log-platform
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
Existing folder
cd existing_folder
git init
git remote add origin git@gitlab.recogizer.net:PlatformOps/log-platform.git
git add .
git commit -m "Initial commit"
git push -u origin master
Existing Git repository
cd existing_repo
git remote set-url origin https://github.com/USERNAME/REPOSITORY.git
------OR------
git remote add origin git@gitlab.recogizer.net:PlatformOps/log-platform.git
git push -u origin --all
git push -u origin --tags
------------------
vim ~/.gitconfig
[alias]
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
```git checkout better_branch
git merge --strategy=ours master # keep the content of this branch, but record a merge
git checkout master
git merge better_branch ```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment