git_basics
git_basics copied to clipboard
Features to be added to the `git commands` section.
- [ ] Plumbing and porcelian commands
- [ ] To show commit SHA1 of HEAD
git rev-parse HEAD
- [ ]
git gc --aggressive
commands. - [ ] Git LFS (large file system)
- Conditions for large files on GitHub
- Storage and Bandwidth Usage
- Atlassian Git LFS overview (Also, the video at end of this article is a good watch.)
- Official Git LFS page
- Migrate history to or from Git LFS
- Alternative way: Split files into multipart zip archive, then either use a Git Hook or a prebuild step to combine and unzip the files.
- [ ] Removing Accidentally Committed Files From Remote History
- [ ] git rebase
- [ ] Short guide
- [ ] Add
git pull --rebase
togit pull
and reference it ingit rebase
. (Optional reference) - [ ] Merging vs Rebasing
- [ ]
git rebase --continue
(--quit
and--abort
)
- [ ] Patches
- Create a patch file from git diff
- Creating and applying a patch
- If the patch is a commit, then just run
git am file.diff
. - If the patch is not a commit, then run
git apply file.diff
and thengit am file.diff
. -
.diff
can be.patch
as well. - Decoding a patch in base64 format
Add all info from the following articles:
- [ ] https://medium.com/mindorks/what-is-git-commit-push-pull-log-aliases-fetch-config-clone-56bc52a3601c
- [ ] https://dev.to/lydiahallie/cs-visualized-useful-git-commands-37p1
- [ ]
git revert
- [ ]
git restore
- [ ] General details
- [ ]
-s
flag
- [ ]
git reset
(+ add commands from #75, although it is meant for #10)
- [ ] Under
git commit
, add the-s
(--signoff
) flag.- Article # 1
- Article # 2
- Check out DCO in relation to
-s
- [ ] Add the
git cherry-pick
command.
- [ ] Under
git checkout
, add the--orphan
flag.- Ref article
- Add the flag, give an explanation on what is does and its need.
-
git rm -rf
orgit reset --hard
might be required (beware of the file not in.gitignore
though.) (source)
- [ ] Under the
--amend
flag ingit commit
, add the--no-edit
option.- Explain that files can be forgotten to be committed or be committed by mistake & add the two cases of amending a commit (to change the commit msg/descp and/or add/remove a file) to the
common mistakes and how to solve them
(#10) sub-section.
- Explain that files can be forgotten to be committed or be committed by mistake & add the two cases of amending a commit (to change the commit msg/descp and/or add/remove a file) to the
- [ ]
git commit
--no-value
option - [x] Add
--author "Full Name <[email protected]>"
option togit commit
.
- [ ] Add a
--staged
flag to thegit diff
command. - [ ] Add the
git mv
command.
- [ ] Co-authored commits
- (I had to use a text editor to write the commit msg as pressing the enter key in cmd executes the command.)
- https://github.blog/2018-01-29-commit-together-with-co-authors/
- https://medium.com/blackode/creating-co-authored-commits-on-the-command-line-git-305ae2af9f73
- [ ] Add
set-url
option togit remote
- https://www.git-scm.com/docs/git-remote
- [ ]
git shortlog
- Add details on
git shortlog
from this as well: https://github.blog/2020-10-19-git-2-29-released/
- Add details on
- [ ] Contextual
git push
andgit pull
. (Find context usinggit branch
.)- Executing just
git push
instead ofgit push origin main
to push code to the main branch. - Might not work the first time as the upstream is not set. Use
git push -u origin main
the first time.
- Executing just
- [x] Add
git config --global init.defaultBranch <branch_name>
to thegit config
sub-section.- This is to combat the new default
main
branch on GitHub. - Add note that this is only for GitHub and might cause problems with other services like GitLab.
- Refer to this comment of issue #47.
- This is to combat the new default
- [ ] From image below make the following changes to the
git branch
sub-section:- Make necessary changes to
-m
option in web site.- Check if what already exists is correct and accordingly make changes.
- Add
-u
flag. - Add references to the branch renaming section if necessary. (The section is supposed to be added as per a comment in issue #21.)
- Make necessary changes to
- [ ] Add
git reflog
documentation- Write about force pushing (Add note: changes history and can cause a lot of problems)
- [ ] Add commands from issue #70.
- [ ] Add
git fsck
- [ ] Add
--author="<regular_exp>"
togit log
(Ref article) - [ ] Add pretty formats to <?>
- Can be used by multiple commands?
- Eg:
git log --pretty="format: %h %aN"
- A pretty format list can be found in Atlessian's
git show
article as well.
- [ ]
git format-patch
- [ ] Add the
-A
option togit commit
and note the difference between-a
and-A
.
- [ ] Add directory option to
git clone
.- Eg:
git clone <url>.git <dir_to_clone_into>
orgit clone <url>.git .
(Same directory, will not create a new directory to put the files in.)
- Eg:
- [ ] Add info about
git tag
.- [ ] Pushing a tag to a remote repository
- [ ] Deleting Local and Remote Tags
- [ ] Git Tag Explained: How to List, Create, Remove, and Show Tags in Git (esp add
git show
- add next point first)
- [ ] Add
git show
- [x] Add
git add -p
- [x] #85
- Merge conflicts: #94
- [ ] Multiple Branches in Git (
git worktree
)