git diff -w
git remove
git rm file1.txt git commit -m "remove file1.txt" But if you want to remove the file only from the Git repository and not remove it from the filesystem, use: git rm --cached file1.txt git rm -r --cached folder git commit -m "remove file1.txt & folder" https://stackoverflow.com/questions/2047465/how-can-i-delete-a-file-from-a-git-repository
git restore branch
1. git reflog 2. git checkout -b https://confluence.atlassian.com/bbkb/how-to-restore-a-deleted-branch-765757540.html
reset local git
rm -rf .git git init
Default git branch in a bare repository
1. cd project.git 2. git symbolic-ref HEAD refs/heads/mybranch HEAD file (master): ref: refs/heads/master HEAD file (branch): ref: refs/heads/branch https://feeding.cloud.geek.nz/posts/setting-default-git-branch-in-bare/
Merge from branch to master
Simple merge from branch to master git checkout master git pull origin master git merge test git push origin master
Git remote
git remote -v git remote add git remote remove git remote rename
Git init –bare
-
-
git init --bareĀ (--bare flag it is generally only used on servers)
-
create file: project.git/hooks/post-receive/
-
Write in file: git --work-tree=/var/www/project --git-dir=/var/repo/project.git checkout -f
-
chmod +x post-receive
-
create project folder: /var/www/project
-
git clear working directory
git checkout . - Removes Unstaged Tracked files ONLY [Type 2] git clean -f - Removes Unstaged UnTracked files ONLY [Type 3] git reset --hard - Removes Staged Tracked and UnStaged Tracked files ONLY[Type 1, Type 2] git stash -u - Removes all changes [Type 1, Type 2, Type 3] Conclusion: It's clear that we can use either (1) combination of `git clean -f` and `git reset --hard` OR (2) `git stash -u`