This repository contains basic git commands
git help
git config
git config --global user.name "rocky"
git config --global user.email "[email protected]"
git config --global color.ui true
To create a local git repository for us in our store folder. This will help to manage the git commands for that particular repository.
git init
To see whatβs changed since the last commit. It shows all the files that have been added and modified and are ready to be committed and files that are untracked.
git status
git add Readme.txt
git commit -m "Created a Readme.txt"
git log
git add
git add --all
git add *.txt
git add docs/*.txt
git add docs/
git add "*.txt"
git diff
git reset HEAD license
git checkout --license
To add any of our tracked files to the staging area and commit them by providing a message to remember.
git commit -a -m "Readme.md"
git reset --soft HEAD^
To undo the last commit and remove the file from the staging area as well (In case we went horribly wrong).
git reset --hard HEAD^
git reset --hard HEAD^^
These commands make a bookmark which signifies that this particular remote refers to this URL. This remote will be used to pull any content from the directory and push our local content to the global server.
git remote add origin https://github.com/something.git
git remote add <address>
git remove rm
To push all the contents of our local repository that belong to the master branch to the server (Global repository).
git push -u origin master
To clone or make a local copy of the global repository in your system (git clone command downloads the repository and creates a remote named origin which can be checked by the command β git remote -v).
git clone https://github.com/something.git
git branch Testing
git branch
git checkout Testing
git merge Testing
git branch -d Testing
git checkout -b admin
git branch -r
git branch -D Testing
git tag
git checkout v0.0.1
git tag -a v0.0.3 -m "version 0.0.3"
git push --tags
git fetch
git stash
git stash pop
git stash clear
3. Run all commits in the temporary area on top of our master one at a time, so it avoids merge commits.
git rebase
git --version
git cherry-pick <commit_hash>
git reflog
git blame <file>
git archive --format=tar <commit_hash> | tar -x -C /path/to/extract
git submodule add <repository_url> <path>
git submodule update --init --recursive
git clean -f
git shortlog
git show <object>
git tag -s <tag_name> -m "message"
git worktree add <path> <branch>
git worktree prune
git revert <commit_hash>
git log --graph --oneline --all
git branch -m <old_name> <new_name>
git pull
git rebase -i <base_commit>
git rebase -i HEAD~<number_of_commits>
git tag -l
git show-branch
git apply <patch_file>
git commit --amend