Trunk-based development
- Monolithic codebase model
- Central repository
- Trunk based development
- Single consistent view of the codebase
- Avoids complexity of merging branches
- Release branches
- Bug fixes developed on mainline
- Both new and old code paths commonly exist simultaneously controlled through the use of conditional flags.
Google workflow
- Automated testing and recovery
- Review code before commit
- The Google codebase is laid out in a tree structure.
- Each and every directory has a set of owners who control whether a change to files in their directory will be accepted. Owners are
- Code reviewers comment on aspects of code quality
- Code quality: design, functionality, complexity, testing, naming, comment quality, and code style
- Static analysis system
- Code-cleanup on regular basis
$ git init --bare --shared=all test.git
$ git init
$ echo 123 > test.txt
$ git add *
$ git commit -m 'First commit'
$ git remote add origin ./test.git
$ git remote add upstreadm ./test.git
$ git push origin master
No objects, no refs/heads, no logs
Each change and add will generate a bloc object git ls-files --stage
The commit will create a commit object and a tree object. The refs/heads will be initialized
git log git cat-file -p
A new commit object is created and the main branch points now to this new commit. The old commit object is not deleted
Use checkout to move HEAD to any commit desired, detached HEAD. Use switch to restore HEAD to point to a branch.
$ git log -5 --oneline
a6cc877 (HEAD -> master) [#####] - Name refactoring of some assets;
d5d064a (origin/master, origin/HEAD) [#####] - Cheat sheet added to assets;
269a11d [#####] - New asset;
4b760d2 [#####] - Git branching model;
d80d7b0 Initial commit
$ git rev-parse a6cc877
a6cc8772b152ab7c2e40fd87dc944eab3ffb1e7d
$ cd .git
$ dir
Mode LastWriteTime Length Name
d----- 8.12.2021 г. 10:50 hooks
d----- 8.12.2021 г. 10:50 info
d----- 8.12.2021 г. 10:50 logs
d----- 8.12.2021 г. 14:41 objects
d----- 8.12.2021 г. 10:50 refs
The first two digits are the directory, last digits the compressed file.
$ cd objects
$ dir
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 8.12.2021 г. 12:00 26
d----- 8.12.2021 г. 10:52 33
d----- 8.12.2021 г. 10:53 39
d----- 8.12.2021 г. 13:55 3b
d----- 8.12.2021 г. 10:50 info
d----- 8.12.2021 г. 10:50 pack
$ cd a6
$ dir
Mode LastWriteTime Length Name
---- ------------- ------ ----
-ar--- 8.12.2021 г. 13:55 181 cc8772b152ab7c2e40fd87dc944eab3ffb1e7d
$ git cat-file -p a6cc877
tree 3b9ab3a0ee2124dd51d91161ab18c284c279c927
parent d5d064a947ac9df07ed2113768f6ae894e102c0f
author braboj <[email protected]> 1638964501 +0200
committer braboj <[email protected]> 1638964501 +0200
https://jigarius.com/blog/multiple-git-remote-repositories#:~:text=Register%202nd%20push%20URL,with%20git%20fetch%20%2D%2Dall%20. https://gist.github.com/rvl/c3f156e117e22a25f242
git remote set-url --add --push origin "httos://github.com/braboj/git-tutorial.git"
git remote set-url --add --push origin "https://gitlab.com/braboj/git-tutorial.git"
PS> git config --global alias.<alias> <command>
PS> git config --global alias.unstage 'reset --HEAD --'
PS> git config --global core.editor <editor + options>
Performs a full copy of the target including files and history. The result is a transparent view of the local project with its dependencies as if it is one single project.
git subtree [<options>] -P <prefix> add <local-commit>
git subtree [<options>] -P <prefix> add <repository> <remote-ref>
git subtree [<options>] -P <prefix> merge <local-commit>
git subtree [<options>] -P <prefix> split [<local-commit>]
git subtree [<options>] -P <prefix> pull <repository> <remote-ref>
git subtree [<options>] -P <prefix> push <repository> <refspec>
# Legend
-------------------------------------------------------------------------------
[] : Optional
<> : Replace
| : OR
# Options
-------------------------------------------------------------------------------
-q, --quiet : Suppress unnecessary output messages on stderr.
-d, --debug : Produce even more unnecessary output messages on stderr.
-P, --prefix : Specify the path in the repository to the subtree
$ git status --short
$ git status --short --branch
$ git status --short --untracked --ignored