Skip to content

Instantly share code, notes, and snippets.

@PierreAlainKouakou
Forked from 101t/Git-Commands.md
Created April 5, 2023 10:30
Show Gist options
  • Save PierreAlainKouakou/0453067b612b472a8e65ceba8c59fc25 to your computer and use it in GitHub Desktop.
Save PierreAlainKouakou/0453067b612b472a8e65ceba8c59fc25 to your computer and use it in GitHub Desktop.
Git Commands Hot and simple tutorials

Simple Commands for "git"

Download Specific version of Single Branch:

git clone -b 0.7.0 --single-branch https://github.com/spchuang/videojs-markers.git

Reference here

Adding github push alias (shortcut) in .bashrc file

alias push_github='echo "Enter commit message : " && read MSG && git add . && git commit -m "$MSG" && git push'

Print git history in pretty way

git log --pretty=oneline --graph --decorate --all

Update sub-repositories in main repository tree

git submodule update --remote --merge

Source: here

To remove un-wanted directory from git manually:

git rm -r --cache .idea/

I modified code on protected branch, ohh!, now I want to move it to new branch

to grap changes on protected branch

git stash
# create new branch
git checkout -b new_branch
# pop your modified code on new_branch
git stash pop

Get remote branch that does not exist on your local git repo.

git fetch origin remote_branch_name
git checkout -b remote_branch_name FETCH_HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment