From 65f7f7fda314d242f1c7d883942747ff03edeff1 Mon Sep 17 00:00:00 2001 From: Julien Le Coupanec Date: Mon, 9 Dec 2019 11:48:40 +0100 Subject: [PATCH] style(git): rework --- README.md | 1 + tools/git.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ tools/git.txt | 55 --------------------------------------------------- 3 files changed, 56 insertions(+), 55 deletions(-) create mode 100644 tools/git.sh delete mode 100644 tools/git.txt diff --git a/README.md b/README.md index ebdaa9a..0dded65 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,7 @@ Feel free to take a look. You might learn new things. They have been designed to #### Development +- [Git](tools/git.sh) - [Sublime Text](tools/sublime_text.md) - [VIM](tools/vim.txt) - [Visual Studio Code](tools/vscode.md) diff --git a/tools/git.sh b/tools/git.sh new file mode 100644 index 0000000..c097771 --- /dev/null +++ b/tools/git.sh @@ -0,0 +1,55 @@ +git init # initiates git in the current directory +git clone
# creates a git repo from given address (get the address from your git-server) + +git add file.txt # adds(stages) file.txt to the git +git add * # adds(stages) all new modifications, deletions, creations to the git +git reset file.txt # Removes file.txt from the stage +git rm file.txt # removes file.txt both from git and file system +git status # shows the modifications and stuff that are not staged yet + +git branch # shows all the branches (current branch is shown with a star) +git branch my-branch # creates my-branch +git branch -d my-branch # deletes my-branch +git checkout my-bracnch # switches to my-branch +git merge my-branch # merges my-branch to current branch + +git remote # shows the remotes +git remote -v # shows the remote for pull and push +git remote add my-remote
# creates a remote (get the address from your git-server) + +git log # shows the log of commits +git commit -m "msg" # commit changes with a msg +git push my-remote my-branch # pushes the commits to the my-remote in my-branch (does not push the tags) + +git tag # shows all the tags +git tag -a v1.0 -m "msg" # creates an annotated tag +git show v1.0 # shows the description of version-1.0 tag +git tag --delete v1.0 # deletes the tag in local directory +git push --delete my-remote v1.0 # deletes the tag in my-remote (be carefore to not delete a branch) +git push my-remote my-branch v1.0 # push v1.0 tag to my-remote in my-branch +git fetch --tags # pulls the tags from remote + +git pull my-remote my-branch# pulls and tries to merge my-branch from my-remote to the current branch + +git stash # stashes the staged and unstaged changes (git status will be clean after it) +git stash -u # stash everything including new untracked files (but not .gitignore) +git stash save "msg" # stash with a msg +git stash list # list all stashes +git stash pop # delete the recent stash and applies it +git stash stach@{2} # delete the {2} stash and applies it +git stash show # shows the description of stash +git stash apply # keep the stash and applies it to the git +git stash branch my-branch stash@{1} # creates a branch from your stash +git stash drop stash@{1} # deletes the {1} stash +git stash clear # clears all the stash + +.gitignore +# is a file including names of stuff that you don"t want to be staged or tracked. +# You usually keep your local files like database, media, and etc here. +# You can find good resources online about ignoring specific files in your project files. +# .gitignore is also get ignored +.git +# is a hidden directory in repo directory including git files. It is created after "git init". + + + diff --git a/tools/git.txt b/tools/git.txt deleted file mode 100644 index eb0c1a7..0000000 --- a/tools/git.txt +++ /dev/null @@ -1,55 +0,0 @@ -git init >> initiates git in the current directory -git clone
>> creates a git repo from given address (get the address from your git-server) -=== -git add file.txt >> adds(stages) file.txt to the git -git add * >> adds(stages) all new modifications, deletions, creations to the git -git reset file.txt >> Removes file.txt from the stage -git rm file.txt >> removes file.txt both from git and file system -git status >> shows the modifications and stuff that are not staged yet -=== -git branch >> shows all the branches (current branch is shown with a star) -git branch my-branch >> creates my-branch -git branch -d my-branch >> deletes my-branch -git checkout my-bracnch >> switches to my-branch -git merge my-branch >> merges my-branch to current branch -=== -git remote >> shows the remotes -git remote -v >> shows the remote for pull and push -git remote add my-remote
>> creates a remote (get the address from your git-server) -=== -git log >> shows the log of commits -git commit -m 'msg' >> commit changes with a msg -git push my-remote my-branch >> pushes the commits to the my-remote in my-branch (does not push the tags) -=== -git tag >> shows all the tags -git tag -a v1.0 -m 'msg' >> creates an annotated tag -git show v1.0 >> shows the description of version-1.0 tag -git tag --delete v1.0 >> deletes the tag in local directory -git push --delete my-remote v1.0 >> deletes the tag in my-remote (be carefore to not delete a branch) -git push my-remote my-branch v1.0 >> push v1.0 tag to my-remote in my-branch -git fetch --tags >> pulls the tags from remote -=== -git pull my-remote my-branch >> pulls and tries to merge my-branch from my-remote to the current branch -=== -git stash >> stashes the staged and unstaged changes (git status will be clean after it) -git stash -u >> stash everything including new untracked files (but not .gitignore) -git stash save 'msg' >> stash with a msg -git stash list >> list all stashes -git stash pop >> delete the recent stash and applies it -git stash stach@{2} >> delete the {2} stash and applies it -git stash show >> shows the description of stash -git stash apply >> keep the stash and applies it to the git -git stash branch my-branch stash@{1} >> creates a branch from your stash -git stash drop stash@{1} >> deletes the {1} stash -git stash clear >> clears all the stash -=== -.gitignore - >> is a file including names of stuff that you don't want to be staged or tracked. - >> You usually keep your local files like database, media, and etc here. - >> You can find good resources online about ignoring specific files in your project files. - >> .gitignore is also get ignored -.git - >> is a hiiden directory in repo directory including git files. It is created after "git init". - - -