This repository has been created for the lab session on Git and GitHub of the Multimedia Systems subject at the University of Extremadura (UEx).
Add the new/modified/deleted files to the repo:
git add <filename>
Instead of filename
you can use .
or --all
to add all the target files to the repository.
To delete a file from the repo:
git rm --cached <filename>
The --cached
option removes the file from the staging area but remains intact inside the working directory.
To commit a change:
git commit -m "<comments>"
To push a commit from local to remote:
git push
Check the status of the repo:
git status
Reverts file changes:
git checkout -- <filename>
Move a file:
git mv <source> <destination>
Show commit logs:
git log
git log --oneline
Common flags: -p <num>
to limit the output, --stat
, -S <function_name>
, --since
, --pretty
.
To discard all changes made after the specified commit (with hash):
git reset --hard <commit hash>
git push --force
The branch pointer is now moved to the specified commit, and all changes after that commit are discarded. Note that this operation cannot be undone, so be careful when using git reset.
Other options:
git restore, revert
Difference between .gitignore rules with and without trailing slash like /dir and /dir/: Link
Like most VCSs, Git can tag specific points in a repository’s history as being important. Typically, people use this functionality to mark release points (v1.0, v2.0, and so on).
Listing the existing tags in Git is straightforward. Just type the following with optional -l
or --list
:
git tag
git log
Creating tags:
git tag -a <number_of_version> -m "<tagging_message>"
where number_of_version
can have the following format: v1.4, v1.8.5, etc.
Adding tags to existing commits:
git tag -a <number_of_version> <commit_hash> -m "<tagging_message>"
git push origin <number_of_version>
Credits to: Link
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.