git:git
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"
Add git sub module
git submodule add git@bitbucket.org:user/<package>.git <destination>
update sub module only
git submodule update --remote <path to the submodule>
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.txt ยท Last modified: 2024/08/25 11:44 by rene