Git & version control
תקציר (מאוד מתוקצר) לשימוש ב-git¶
- מכינים ssh key
- מחברים אותו ל-git דרך האתר
- מתחברים עם SSH
- עושים Clone לאחד ה-repos שלנו או של אחרים
- עושים Add כדי להוסיף קבצים לרפו (כשהם בתוכו אצלנו) - אפשר add . כדי לעדכן את כל הקבצים ב-repo
- עושים git commit כדי לשמור נקודת ציון
- עושים git push כדי להפוך אותה לסופית אצל אחד ה-branchים
- לרוב בדברים פשוטים זה יהיה git push origin main
-
אוריג'ין זה שם שהמחשב נותן לרפו, גם כשיש לו שם - אפשר לעשות
git remote -v
כדי לראות איזה יש (רק ביחס לתיקיה שעומדים עליה, אם זה בתיקיה שלא קשורה ל-remote, אז לא נראה.) -
ההבדל בין Pull ל-clone זה ש-Pull לא מוריד לנו מחדש את הרפו - הוא פשוט מעדכן אותו אצלנו במחשב בהתאם לגרסה שעשינו לה Pull
git init
הופך את התיקיה הנוכחית לרפוgit remote add remote-name <repo-ssh-url>
כדי להוסיף רפו מקומי לגיטהאב-
בגדול ברגע שיש רפו מקומי ויש remote אפשר לעשות push:
git push remote-name branch-name
(אם התחלנו מרפו שיושב ב-github ועשינו clone, אז יש כבר remote...) -
git commit -m .
כדי לעשות קומיט לכל מה שבתיקיה (ולא להיכנס לנאנו...)
upstream & downstream¶
The supply chain is often divided into two parts: upstream and downstream. Upstream supply chain is the process of getting materials to the manufacturer, while downstream supply chain is the process of getting products from the manufacturer to the end consumer.
within the context of software development: The "stream" is a flow of ownership or authority. If you clone a remote git repo to your machine, your copy is downstream of the remote, and the remote is upstream of your local copy. The upstream is where you get the information from, e.g. when doing git fetch
. Like when you get water from a river, the water you get comes from "upstream".
(מי שאתה עובד על הפיתוח שלו הוא upstream לעומתך) (עבור מפתח תוספים ל-Chrome, כרומיום = upstream; אם מישהו מפתח פלאגינים לתוסף: עבור מפתח התוסף הוא downsream, ומפתח הפלאגין הוא upstream עבור מפתח התוסף)