Skip to content

Git commandline

met enkel de git shell commando’s werkt git op zich prima
maar er is 1 groot nadeel :
iedere communicatie naar github moete telkens username & acess token worden ingegeven
maar mischien is er een optie voor shh certificates

git versions

laptop :
git –version => git version 2.25.1 (synaptic : 1:2.25.1 => epoch 1 version 2.25.1 )
latest :
https://git-scm.com/download/linux latest is 2.41.0 => installed by LXM probarly
almalinux :
git –version => git version 2.39

git commands

! prima doc : https://medium.com/mindorks/what-is-git-commit-push-pull-log-aliases-fetch-config-clone-56bc52a3601c
git status : both working area and staging area
git clone
git add ( = stage in GUI )
git commit (comit staging into repo )
push (push changes to remote)

git commands

? checkout
git init : create a local repo

move a local project into git(hub)

  • have user account on a git server such as  GitHub or gogs .
  • on the git server
    - create a repo
    - get the the repo url
    - github > menu > clone > copy url ; bv : https://github.com/WardMalesys/notes.IT.git )
    - [[gogs setup & config#create a new repository via command line with gogs]]
  • in bash locally
    - cd to local repo copy , and :
# either 
git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
git clone https://github.com/WardMalesys/notes.IT.git 
# or 
git init # create  a local repo


# see changes etc : 
git status

### after  making changes 

# add the changes to staging : 
git add --all   
# or single change  : 
git add {filename+ ext}
# Use `git add --all` with caution. You do not want to add things like credential files, `.DS_Store` files, or history files.

# to local repo
git commit

# sync local repo with github
git push

store the .git folder outside the files location

it is possible , but you need to create a .git file in that location (not the .git folder )
the repository must know where the work tree is and vice versa
.git file

gitdir: /path/to/repo.git

you You can initialize a new separate repository with

git init --separate-git-dir /path/to/repo.git

see the discussion in https://stackoverflow.com/questions/505467/can-i-store-the-git-folder-outside-the-files-i-want-tracked/8603156#8603156

you can also create a symlink into the repos folder , but evaluate this
, the .gitfolder must be inside the working dir ?

update git repo after chnages in working dir

cd /mnt/data/PKS/nota/notes.IT/
cd /mnt/data/PKS/nota/notes.wm/   
cd /mnt/data/creata/scripta/

git status
git add --all
git commit -m "xxxxx"
git push -u origin master

view history

git log _–oneline
oneline flag causes git log to display :
- one commit per line.
- the first seven characters of the SHA.
- the commit message.