logoDevDeck

Developer Cheat Sheets

Quick reference for Git commands and Linux basics in Sinhala and English

Setupgit init

Initialize a new Git repository

අලුත් Git repository එකක් පටන් ගන්න

git init
Setupgit clone <url>

Clone a repository from remote

Repository එකක් copy කරන්න

git clone https://github.com/user/repo.git
Basicgit add <file>

Add file to staging area

file එකක් staging area එකට එකතු කරන්න

git add index.html
Basicgit add .

Add all files to staging area

සියලුම files staging area එකට එකතු කරන්න

git add .
Basicgit commit -m 'message'

Commit changes with message

වෙනස්කම් ටික message එකක් එක්ක commit කරන්න

git commit -m 'Add new feature'
Basicgit status

Check repository status

repository එකේ තත්වය පරීක්ෂා කරන්න

git status
Basicgit log

View commit history

commit කරපු ඉතිහාසය බලන්න

git log --oneline --graph
Remotegit push origin <branch>

Push changes to remote branch

වෙනස්කම් remote branch එකට push කරන්න

git push origin main
Remotegit pull

Pull latest changes from remote

remote එකෙන් අලුත් වෙනස්කම් pull කරන්න

git pull origin main
Branchinggit branch

List all branches

සියලුම branches බලාගන්න

git branch -a
Branchinggit checkout <branch>

Switch to branch

branch එකට මාරු වන්න

git checkout develop
Branchinggit checkout -b <branch>

Create and switch to new branch

නව branch එකක් හදලා ඒකට මාරු වන්න

git checkout -b feature/login
Branchinggit merge <branch>

Merge branch into current branch

branch එක දැන් branch එකට merge කරන්න

git merge feature/login
Advancedgit stash

Temporarily save uncommitted changes

commit නොකළ වෙනස්කම් තාවකාලිකව save කරන්න

git stash push -m 'work in progress'
Advancedgit stash pop

Apply and remove latest stash

අවසාන stash එක apply කර remove කරන්න

git stash pop
Advancedgit diff

Show changes between commits, commit and working tree, etc.

commits, working tree අතර වෙනස්කම් පෙන්වන්න

git diff HEAD~1
Power Usergit reflog

Show a log of reference changes (e.g., HEAD changes). Your safety net!

Reference වෙනස්වීම් වල log එක බලන්න

git reflog
Power Usergit rebase -i HEAD~<n>

Interactively rebase the last <n> commits (squash, edit, reorder).

අවසාන commits <n> ගණන interactiveව rebase කරන්න.

git rebase -i HEAD~3
Power Usergit bisect

Find the commit that introduced a bug using binary search.

Binary search මගින් bug එකක් හඳුන්වා දුන් commit එක සොයාගන්න.

git bisect start; git bisect bad; git bisect good <commit-hash>
Power Usergit cherry-pick <commit-hash>

Apply the changes from a specific commit onto the current branch.

වෙනත් branch එකක commit එකක් දැන් branch එකට apply කරන්න.

git cherry-pick a1b2c3d4
Advancedgit reset --soft HEAD~1

Uncommit changes, keeping them in the staging area.

අවසන් commit එක cancel කර, වෙනස්කම් staging area එකේ තියාගන්න.

git reset --soft HEAD~1