- Download and install Git for Windows
- Create a repository:
cd ~/Desktop && mkdir first && cd first
git init- Add readme:
touch readme.md- Add it to git and then commit:
git add .
git commit -m "Add readme.md"- Check if there any ssh keys exist already:
ls -la ~/.ssh/- Now generate the key:
ssh-keygen -t ed25519 -C- Copy the public key:
clip < ~/.ssh/id_ed25519.pub- Add it to your github profile
- Check if it works:
ssh -T git@github.com
yes- Add repo to GitHub. Just create there new repo and get its SSH address
git remote add origin git@github.com:fyefh5/first.git- Check if it works:
git remote -v- push commit:
git push -u origin main- For next pushes just use
git bush- There are hashes that identify each commit uniquely
git log- 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;
git commitcommits only those files that are ingit addwhich can be checked via
git status-
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.
-
git log --onelineshows shortened commits which is useful when there are too many of them -
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.