git init this command initializes the repository.git init
git add this command adds file/files to the repository.git add file_name.ex...
For further actions, you may consider blocking this person and/or reporting abuse
Here are more practical ones(IMHO):
Change the last commit message
git commit --amend
Revert last unpushed commit
git reset HEAD~1 --soft
Show log one line
git log --oneline
Press q to exit
Delete a local branch
git branch -d <BRANCH NAME>
Ignore push and merge status and force delete:
git branch -D <BRANCH NAME>
Delete a remote branch
git push <REPOSITORY REF> --delete <BRANCH NAME>
example:
git push origin --delete beta-1.0.0
If branch ref is equal to a tag ref:
git push <REPOSTIORY REF> :refs/heads/<BRANCH NAME>
example:
git push origin :refs/heads/beta-1.0.0
And
git checkout -b <new-branch-name>
ty!
And
git log --all --graph --oneline
git status -s
Great list, if I was to add one:
git cherry-pick [commit id here]
incredibly useful to pick specific commits when you don't want the branch.It is always better to use
git checkout [commit id here || branch name] [filename of other branch]
than cherry pickNot always better. They work differently:
cherry-pick
will append the specified commit to the current one.checkout
will bring the specified commit's changes to the working directory (it's up to you to commit those changes).It really depends on what you want to do. I use both frequently.
thank you
git remote add <remote-name> <remote-url>
Add remote to project
git remote rename <old-remote-name> <new-remote-name>
Rename project remote
git remote rm <remote-name>
Delete remote from project
Something related to
git remote
which helps in changing the existing remote URL for a remote.Yes, forgot this one
Thank you very much 🙏
great
I find this extremely useful a lot of times
git reflog
Shows the history of the local HEAD. Useful when you lost some local code recently
I must sincerely say that I find this write up helpful. Thank you all