Utilities: Git: Basics - eliminmax/cncs-journal GitHub Wiki
Meaning of different command prompts
Unix/Linux:$
: can be run as normal user
Unix/Linux:#
: must be run as root (or withsudo
)
Windows:>
: Command Prompt or PowerShell
Windows:PS>
: PowerShell only
Unix/Linux and Windows:$/>
,#/>
: Works in Windows and Unix/Linux.
This page will introduce the most basic uses of the git
version control system
Odds are, you already have git installed. If not, you can install it:
-
On modern systems that support the
apt
command, run# apt install -y git
-
On older systems that don't support the
apt
command, run# apt-get install -y git
If you don't have git installed already, run # yum -y install git
-
Go to https://git-scm.com/download, and click the Windows icon.
-
Run the installer
$ git clone user@host-or-ip:path/to/repository.git
$ git clone https://host-or-ip/path/to/repository.git
$ git pull
$ git checkout .
Useful if a file is deleted or overwritten by mistake
Even if a file is added to your local copy of a repository, it won't be added to the git repo automatically. To add it, you need to run this command.
$ git add filename.ext
$ git commit
$ git commit file0.ext file1.ext file2.ext
$ git commit -m "Commit message"
You can combine this with the previous one:
$ git commit -m "Commit message" file0.ext file1.ext file2.ext
$ git push
Changes must be committed for this to go through.