Skip to content

Latest commit

 

History

History
120 lines (83 loc) · 2.29 KB

README.md

File metadata and controls

120 lines (83 loc) · 2.29 KB

Git Jafewoul ⚙️

A collection of very useful and little-known Git commands.

Version FR 👉🏽 here

Made-In-Senegal

Contribute 🤝🏽

Also want to add a command that you find useful ?
Feel free to fork the project to add your contribution ✨

Create and switch a branch (one line)

git checkout -b name_of_my_new_branch

Delete a branch present on the remote repo

git push origin --delete
# after
name_of_my_remote_branch

Update the local repository of a specific branch

git pull origin my_branch

Clone a specific branch

git clone -b name_of_my_remote_branch git_project_url

Edit last commit message

git commit --amend

Add (forgotten) files to last commit

git add my_file
# after
git commit --amend

Show all commit information (hash, messages, dates, author)

git log

Show information about a specific commit count

# replace N with the number of commits you want to display
git log -N

Displays a set of commits according to a date slice

# date in DD/MM/YYYY format
git log --since=date --until=date

Shows each commit by author (useful on group projects)

git shortlog

Displays a graphical repository browser

# it can be thought of as a GUI wrapper for git log command
gitk

Undo last commit (soft)

# only the commit is removed from Git, your files remain modified
git reset HEAD^

Undo before last commit

# only the commit is removed from Git, your files remain modified
git reset HEAD^^

Undo commits and lose all changes (hard)

# this will unconfirm all your work
git reset --hard HEAD^

Search for a specific word or phrase in the files of a Git repository

# to search for all occurrences of "hello"
git grep "hello"

fsck (File System Check) is used to verify the integrity of a Git repository

# detects and reports corrupted objects or broken links in the repository
git fsck