linux:git

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux:git [2019/05/24 13:03] mhlinux:git [2020/06/01 16:35] (current) – external edit 127.0.0.1
Line 15: Line 15:
 </code> </code>
  
 +==== Branches ====
 +
 +Switch branch (option create)
 +<code>
 +git checkout branch_name
 +git checkout -b create_branch_name
 +</code>
  
 ==== Atom, Git and Rust ==== ==== Atom, Git and Rust ====
  
-I need to write clear procedure on how to manage with the graphical interface git for rust projects. Cargo initializes rust as a local git repository, but linking it with a remote project, in GitLab for instancedoes not automatically activate the graphical git interface in Atom.+When you create new Rust project using Cargo it automatically initializes a local git repository
 + 
 +To connect it with a remote repository follow the basic instructions : 
 + 
 +<code> 
 +cd existing_folder 
 +git init //Skip if in a Rust project created with cargogit is already initialized 
 +git remote add origin <remote_repo_url> 
 +git add . //required 
 +git commit -m "Initial commit" //Feel free to change the message 
 +git push -u origin master //This is what actually pushes. 
 +</code> 
 + 
 +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 ityour 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: 
 + 
 +<code> 
 +git push --all --set-upstream origin  
 +</code> 
 + 
 +==== Branching ==== 
 +//The following is still under test and uncertain, but seems to have worked already. The commands are probably not optimized (i.e. git pull calls git fetch already so it may not be required, but this needs additional testing to clear out// 
 + 
 + 
 +When creating another branch, to have it appear in Atom run the following command : 
 + 
 +<code> 
 +git fetch origin 
 +</code> 
 + 
 +This will fetch all the data in the origin's repository, which should be your remote repo if everything is configured correctly. 
 + 
 +Then run : 
 + 
 +<code> 
 +git pull origin <name-of-branch> 
 +</code> 
 + 
 +This should update the local repository to the current tip of the head from the branch you are pointing to. 
 + 
 +If this does not work, maybe it is required to create the branch in atom with the "new branch" button with an identical name but I doubt so. 
 + 
 + 
 + 
 + 
 +===== Ressources ===== 
 + 
 +[[https://git-scm.com/book/en/v2/Getting-Started-About-Version-Control|Git book]]
  • linux/git.1558695800.txt.gz
  • Last modified: 2020/06/01 16:35
  • (external edit)