Category: git

Rewriting your git history, removing files permanently

see this great article at https://blog.gitguardian.com/rewriting-git-history-cheatsheet/ Steps: 1) Install newest git version (as git >= 2.22.0 is required) For Ubuntu, this PPA provides the latest stable upstream Git version: add-apt-repository ppa:git-core/ppa apt update; apt install git see: https://git-scm.com/download/linux 2) install git-filter-repo python3 -m pip install –user git-filter-repo 3) Do it – here remove the file git filter-repo –use-base-name –path [FILENAME]...

Gitea & Github

1) Setup private Gitea repository (name: origin) .. and push current branch there (default branch is “master”): git remote add origin https://gitea-url/test.git git push -u origin master 2) Add a new branch publish git branch publish git checkout publish 3) Setup public Github repository (name: public) .. and push branch “publish” to this repository called “public” (careful: default branch is...

Git Repository inside other Git Repository

use “Git Submodules” see: https://git-scm.com/book/en/v2/Git-Tools-Submodules Example: > git submodule add https://url/example.git Target-Folder Quote: “Although is a subdirectory in your working directory, Git sees it as a submodule and doesn’t track its contents when you’re not in that directory. Instead, Git sees it as a particular commit from that repository.” (https://git-scm.com/book/en/v2/Git-Tools-Submodules)

Arch AUR – yay “xy is not a clone of https://github.com/xxx.git”

Problem: The AUR yay-update of a package fails with the error message like “xy is not a clone of https://github.com/xy.git” Solution: Delete the source clone mentioned in the error message. Be careful: Not the PKGBUILD, but the clone that goes into the same directory as the PKGBUILD by default. Afterwards yay will clone the repository again and update.

Oh-my-Git

Found a nice interactive game for learning git: https://blinry.itch.io/oh-my-git Sometimes for me it was not clear what’s the mission, but still quiet nice for beginning to get to known git. Useful commands for commits: go to prevoius commit: git checkout HEAD^ go back two commits: git checkout HEAD~2 Useful commands for branches: create a branch called name at current location:...

Git – Good to know

In this post i’d like to note some handy tricks when using git. Good to know: git commit –amend = replace (add to) last commit git remote add <alias> <URL> = connect remote repository git push origin/<branch> = upload changes to remote repository git restore – use this command to undo local changes and replace the file with the one...