Cara Git
GIT
-
Git - VCS - mendistribusikan codenya - kolaburasi dengan member lain
-
Distribute - Dari server githubnya / repo - clone , ada yg local & servernya git
-
Central lice - hardisk
-
History - folder - yg di deleted tetap ada historynya
-
Clone - https - sign in username pass
-
Protocol pake ssh
GIT Command
- Git init - untuk inilisasi projek itu ke GIT
- Git add. - nambahin file itu ke GIT - file nya nanti akan di commit
- Git commit -
ex :
git commit -m "<Message>"
- Git Branch
- Master
- Local
- ex :
git checkout <barnch_name>
- Git branch baru -
Git checkout branch -b & Git branch
- Git status
- Git log -
history commit
- Git push origin (branch_name)
- git show commitID - code yg ditambahin
- git pull - ngambil repositori terupdate
- exp :
git pull origin master
- exp :
- git merge - penggabungan branch 1 & yg lainnya
- Merge operation -
local
- pull request operation
remote -
pull request
- git rebase - re-apply commit di branch lain
exp :
git rebase <branch_name>
- git stash - uncommitted changes in your branch away
- exp :
git stash
- exp :
- git stash pop - buat mengembalikan code yg sudah di hilangkan shift command. - finder (untuk lihat file yg ke hidden)
- ls -al (lihat folder git )
gitignore
- gk semua dimasukin ke reporisitori
Latihan 1
- Create new repo
- project nya apa
- inisialisasi
- shift command. - finder (untuk lihat file yg ke hidden)
- ls -al (lihat folder git )
gitignore
- gk semua dimasukin ke reporisitori exp : vi gitignore - insert - i - masukkan file yang tidak dimasukkan ke repo - esc :wq- git status
- git add . - kalau mau dimasukkin semua filenya ke repo
- git commit - m “”
- git status
- git log
- git remote add origin git@github.com:sitiwulandari/The-Print-Project.git
- git remote
NEW SSH in github https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
- go to terminal
- $ ssh-keygen -t rsa -b 4096 -C “your_email@example.com”
- cd ~
- pwd
- cd .ssh
- cat id_rsa.pub
- copy
ssh-rsa
- back to Intelli
- git push origin master - Yes
- check repo
- create branch develop
- git clone code in repo
public class Mokateers {
private int employeeId;
private String name;
private long salary;
public Mokateers(int employeeId, String name, long salary) {
this.employeeId = employeeId;
this.name = name;
this.salary = salary;
}
public int getEmployeeId() {
return employeeId;
}
public String getName() {
return name;
}
public long getSalary() {
return salary;
}
public void print(){
System.out.println("Name :" + getName());
System.out.println("Employee ID : " + getEmployeeId());
System.out.println("Salary" + getSalary());
}
}
git checkout branch git
Written on December 19, 2019