This commands will be useful to set up your project/directory
This commands will be useful in the lifecycle project
# ignore all .a files
*.a
# but do track lib.a, even though you're ignoring .a files above
!lib.a
# only ignore the TODO file in the current directory, not subdir/TODO
/TODO
# ignore all files in any directory named build
build/
# ignore doc/notes.txt, but not doc/server/arch.txt
doc/*.txt
# ignore all .pdf files in the doc/ directory and any of its subdirectories
doc/**/*.pdf
- First, check in which branch you are right now:
git branch
You'll get a list of the branchs available, the branch with an *
next to it, is the branch you are working on.
- Then, create a new branch:
git branch name_of_the_branch_to_create
- Move to the new branch created:
git checkout name_of_the_branch_to_create
- You can do step 2 and 3 by one command:
git checkout -b name_of_the_branch_to_create
$ git commit --amend
- edit the file(s)
- save the file(s)
- stage the file(s)
- and run
git commit --amend
$ git revert <SHA-of-commit-to-revert>
At first glance, resetting might seem coincidentally close to reverting, but they are actually quite different. Reverting creates a new commit that reverts or undos a previous commit. Resetting, on the other hand, erases commits!
Before I do any resetting, I usually create a backup branch on the most-recent commit so that I can get back to the commits if I make a mistake.
$ git remote set-url origin [email protected]