FAQ - git
Commonly used git operations
git reset
git reset HEAD
git fetch j143 <branch-name>
git branch -d -r origin/branch-name
git remote set-url --add <name> <new-url>
git push --set-upstream origin new-local-branch
git reset commit-SHA --hard
We cannot add empty directory. But, we need to keep a file
.gitkeep
or .gitignore
or just .keep
file with empty contents. For example, touch .keep
would create a .keep
file.specifying
git add <dir>
would add dir/file1
and dir/file2
.> git status
On branch master
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: install.md
modified: MultiLogReg.dml
new file: MLogRegTest.java
> git restore --staged MultiLogReg.dml MLogregTest.java
> git status
On branch master
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: install.md
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: MultiLogReg.dml
Untracked files:
(use "git add <file>..." to include in what will be committed)
MLogregTest.java
> git stash
> git commit -m "update only install.md file"
Last modified 2yr ago