Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

Creation of my first git

Initialize local git repository

  1. Download and install Git for Windows
  2. Create a repository:
cd ~/Desktop && mkdir first && cd first
git init
  1. Add readme:
touch readme.md
  1. Add it to git and then commit:
git add .
git commit -m "Add readme.md"

Initialize remote git repository at GitHub

  1. Check if there any ssh keys exist already:
ls -la ~/.ssh/
  1. Now generate the key:
ssh-keygen -t ed25519 -C
  1. Copy the public key:
clip < ~/.ssh/id_ed25519.pub
  1. Add it to your github profile
  2. Check if it works:
ssh -T git@github.com
yes
  1. Add repo to GitHub. Just create there new repo and get its SSH address
git remote add origin git@github.com:fyefh5/first.git
  1. Check if it works:
git remote -v
  1. push commit:
git push -u origin main
  1. For next pushes just use
git bush

git log

  1. There are hashes that identify each commit uniquely
git log
  1. File states:
graph LR;
  untracked -- "git add" --> staged;
  staged    -- "git commit -m 'message_1'" --> tracked;
  tracked -- "modify this file" --> modified;
  modified -- "git add" --> staged;
  staged -- "git commit -m 'message_n'" --> tracked;
Loading
  1. git commit commits only those files that are in git add which can be checked via
git status
  1. In the .git/ you can see HEAD file which contains the hash of the latest commit. You can also use HEAD instead of the latest hash.

  2. git log --oneline shows shortened commits which is useful when there are too many of them

  3. for oneline representation there is space for only 72 symbols. So, you should make message <= 72 symbols long. Also, you should associate each commit with certain problem via certain style:

  • Jira-ID: LGS-239;
  • conventional commits: feat, fix;
  • GitHub: #334;
  • or somehow else.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors