Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision Next revisionBoth sides next revision | ||
linux:git [2019/05/24 12:25] – created mh | linux:git [2019/10/16 20:58] – [Atom, Git and Rust] mh | ||
---|---|---|---|
Line 4: | Line 4: | ||
I prefer using Graphic interfaces that help a lot with git management like in Atom, but here is a recap of basic commands so I remember them when I need. | I prefer using Graphic interfaces that help a lot with git management like in Atom, but here is a recap of basic commands so I remember them when I need. | ||
+ | |||
+ | [[https:// | ||
==== Stage / Commit / Push ==== | ==== Stage / Commit / Push ==== | ||
+ | < | ||
+ | git add the.file | ||
+ | git commit -m "The message" | ||
+ | git push | ||
+ | </ | ||
+ | |||
+ | ==== Branches ==== | ||
+ | |||
+ | Switch branch (option create) | ||
+ | < | ||
+ | git checkout branch_name | ||
+ | git checkout -b create_branch_name | ||
+ | </ | ||
+ | |||
+ | ==== Atom, Git and Rust ==== | ||
+ | |||
+ | When you create a new Rust project using Cargo it automatically initializes a local git repository. | ||
+ | |||
+ | To connect it with a remote repository follow the basic instructions : | ||
+ | |||
+ | < | ||
+ | cd existing_folder | ||
+ | git init //Skip if in a Rust project created with cargo, git is already initialized | ||
+ | git remote add origin < | ||
+ | git add . //required | ||
+ | git commit -m " | ||
+ | git push -u origin master //This is what actually pushes. | ||
+ | </ | ||
+ | |||
+ | You will be prompted for username and password of owner of the Git distant repository. | ||
+ | |||
+ | Atom has a built-in git feature that will automatically detect git repositories and has a useful GUI. To use it, your project root folder **must be directly** in the project tree manager. It cannot be in a sub-directory or Atom will **not** autodetect the git repository. | ||
+ | |||
+ | If you want to set all of your branches to automatically use this remote repo when you use git pull, add --set-upstream to the push: | ||
+ | |||
+ | < | ||
+ | git push --all --set-upstream origin | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ===== Ressources ===== | ||
+ | [[https:// |