User Tools

Site Tools


git:git

This is an old revision of the document!


Initialize git repository

$ git init

Connect to remote repository (bitbucket)

$ git remote add origin git@bitbucket.org:<user>/<repository>

Connect to remote repository (gitlab)

$ git remote add origin git@gitlab.com:<user>/<repository>

First push to remote repository

 git push -u origin master

Change remote url (gitlab)

git remote set-url origin git@gitlab.com:<user>/<repository>

Config alias

 $ git config --global alias.hist "log --oneline --graph --decorate --all "
 $ git config --global alias.hisn "log --oneline --graph --decorate --name-only --all "

Git Config Options

 $ git config --global user.name "John Doe"
 $ git config --global user.email johndoe@example.com
 $ git config --global core.editor nano
 $ git config --global pager.log false

Pager only for long output

To only use pager for output longer than one page

 $ git config --global --replace-all core.pager "less -F"

Clear git repository on Bitbucket

Source: https://stackoverflow.com/questions/13669410/clear-git-repository-on-bitbucket

No need to delete it.

From your new local repo create directory or remote simple the .git, if you want upload (without history) an existing repo:

 $ rm -rf .git

Recreate the repos from the current content only

 $ git init
 $ git add .
 $ git commit -m "Initial commit"

Then simply push to the github remote repos ensuring you overwrite history:

 $ git push --force -u origin master

That will replace the history of your BitBucket master branch by the new one you have done locally.

Now, if you had pushed other branches before, you might want to delete them.

 $ git push origin :oldBranch
git/git.1667589353.txt.gz ยท Last modified: 2022/11/04 20:15 by rene