Linux, Git & Github cheat-sheet

Linux, Git & Github cheat-sheet

DAY 12 Devops challenge

Git & Github:

CommandDescriptioncommandDescription
git initInitialize 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 listList 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 --tagsPush all tags to the remote repository.
git statusCheck the status of your repository.git reflogShow a log of all Git references.
git diffShow changes between commits, the working directory, or branches.git remote add <name> <url>Add a new remote repository.
git logView commit history.git config --globalSet or get global Git configuration options.
git branchList, 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 HEADDiscard all changes and reset to the last commit.
git pullFetch and merge changes from a remote repository.git pull origin <branch>Fetch and merge changes from a specific branch of the remote repo.
git pushPush local changes to a remote repository.git clean -dfRemove untracked files and directories.
git remoteManage remote repositories.git revert <commit>Create a new commit to reverse the changes made by a specific commit.
git stashTemporarily save changes that are not ready to be committed.git show-branchShow branches and their commits.
git resetUndo commits or unstage changes.git log --onelineShow compact commit history with each commit on a single line.
git rebaseReapply commits on top of another base commit.git log --statShow commit history with file statistics.
git tagCreate and manage tags.git bisectFind the commit that introduced a bug using binary search.
git fetchDownload objects and references from a remote repository.git fetch origin <branch>Fetch changes from a specific branch of the remote repository.
git cherry-pickApply a specific commit from one branch to another.git cherry-pick --abortAbort the current cherry-pick operation.
git rebase -iInteractively rebase commits.git submoduleManage Git submodules.
git blame <file>Show who last modified each line of a file.git merge --no-ffPerform 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 -vView the remote repositories and their URLs.git blame -L <start>,<end> <file>Show who modified specific lines of a file.
git log --graphVisualize commit history as a graph.git branch -m <oldname> <newname>Rename a branch.

Linux :

CommandDescriptionCommandDescription
lsList 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.
pwdPrint 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>.zipExtract 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 -aPrint system information.useradd <username>Create a new user.
whoamiPrint the current username.userdel <username>Delete a user.
hostnamePrint the hostname of the system.passwd <username>Change user password.
dfDisplay disk space usage.su <username>Switch to another user.
freeDisplay free and used memory.sudo <command>Execute a command as superuser.
topDisplay system processes in real-time.ping -c <count> <host>Send a specified number of ICMP echo requests to a host.
psDisplay running processes.dd if=<input_file> of=<output_file>Convert and copy a file.
du -sh <directory>Estimate file/directory space usage.historyView command history.
ifconfigDisplay 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 : )

linkedin.com/in/prabir-kumar-mahatha-6a0025..

visit my git hub profile : github.com/PrabirKumarMahatha