Git & Github:
Command | Description | command | Description |
git init | Initialize a new Git repository. | git branch -D <branch> | Forcefully delete a branch. |
git clone <repository> | Clone a remote repository to your local machine. | git stash list | List all stashes. |
git add <file> | Add a file to the staging area. | git checkout -b <branch> | Create a new branch and switch to it. |
git commit -m "message" | Commit changes with a descriptive message. | git push origin --tags | Push all tags to the remote repository. |
git status | Check the status of your repository. | git reflog | Show a log of all Git references. |
git diff | Show changes between commits, the working directory, or branches. | git remote add <name> <url> | Add a new remote repository. |
git log | View commit history. | git config --global | Set or get global Git configuration options. |
git branch | List, create, or delete branches. | git log --author=<author> | Show commit history by a specific author. |
git checkout <branch> | Switch to a different branch. | git log --grep=<pattern> | Search commit history by a specific pattern. |
git merge <branch> | Merge changes from one branch into the current branch. | git reset --hard HEAD | Discard all changes and reset to the last commit. |
git pull | Fetch and merge changes from a remote repository. | git pull origin <branch> | Fetch and merge changes from a specific branch of the remote repo. |
git push | Push local changes to a remote repository. | git clean -df | Remove untracked files and directories. |
git remote | Manage remote repositories. | git revert <commit> | Create a new commit to reverse the changes made by a specific commit. |
git stash | Temporarily save changes that are not ready to be committed. | git show-branch | Show branches and their commits. |
git reset | Undo commits or unstage changes. | git log --oneline | Show compact commit history with each commit on a single line. |
git rebase | Reapply commits on top of another base commit. | git log --stat | Show commit history with file statistics. |
git tag | Create and manage tags. | git bisect | Find the commit that introduced a bug using binary search. |
git fetch | Download objects and references from a remote repository. | git fetch origin <branch> | Fetch changes from a specific branch of the remote repository. |
git cherry-pick | Apply a specific commit from one branch to another. | git cherry-pick --abort | Abort the current cherry-pick operation. |
git rebase -i | Interactively rebase commits. | git submodule | Manage Git submodules. |
git blame <file> | Show who last modified each line of a file. | git merge --no-ff | Perform a merge with a commit even if it is a fast-forward. |
git show <commit> | Show information about a specific commit. | git log --since=<date> | Show commit history since a specific date. |
git remote -v | View the remote repositories and their URLs. | git blame -L <start>,<end> <file> | Show who modified specific lines of a file. |
git log --graph | Visualize commit history as a graph. | git branch -m <oldname> <newname> | Rename a branch. |
Linux :
Command | Description | Command | Description |
ls | List files and directories. | ssh <user>@<host> | Securely log in to a remote server. |
cd <directory> | Change directory. | scp <file> <user>@<host>:<destination> | Securely copy files to a remote server. |
pwd | Print working directory. | wget <url> | Download files from the web. |
touch <file> | Create an empty file. | curl <url> | Transfer data to or from a server. |
cp <source> <destination> | Copy files and directories. | tar -czvf <archive>.tar.gz <files> | Create a compressed tar archive. |
mv <source> <destination> | Move or rename files and directories. | gzip <file> | Compress files (gzip format). |
rm <file> | Remove files. | gunzip <file> | Decompress files (gzip format). |
cat <file> | Display file content. | zip <archive>.zip <files> | Create a zip archive. |
head <file> | Display the first lines of a file. | unzip <archive>.zip | Extract files from a zip archive. |
tail <file> | Display the last lines of a file. | grep -r <pattern> <directory> | Search for patterns recursively in files. |
chmod <permissions> <file> | Change file permissions. | awk <pattern> <file> | Text processing and pattern matching. |
chown <user> <file> | Change file ownership. | sed 's/<pattern>/<replacement>/' <file> | Stream editor for text manipulation. |
find <directory> -name <name> | Search for files and directories by name. | sort <file> | Sort lines in a file. |
grep <pattern> <file> | Search for patterns in files. | cut -d <delimiter> -f <fields> | Remove sections from lines of files. |
ln -s <target> <link> | Create a symbolic link. | wc -l <file> | Count the number of lines in a file. |
uname -a | Print system information. | useradd <username> | Create a new user. |
whoami | Print the current username. | userdel <username> | Delete a user. |
hostname | Print the hostname of the system. | passwd <username> | Change user password. |
df | Display disk space usage. | su <username> | Switch to another user. |
free | Display free and used memory. | sudo <command> | Execute a command as superuser. |
top | Display system processes in real-time. | ping -c <count> <host> | Send a specified number of ICMP echo requests to a host. |
ps | Display running processes. | dd if=<input_file> of=<output_file> | Convert and copy a file. |
du -sh <directory> | Estimate file/directory space usage. | history | View command history. |
ifconfig | Display network interface configuration. | chmod +x <file> | Add execute permission to a file. |
ping <host> | Send ICMP echo requests to a host. | ln <source> <link> | Create a hard link. |
For another git related blogs.
Follow me on LinkedIn to see interesting posts like this : )