New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Section on "Branching" in relation to collaboration. #441

Open
brandonkrull opened this Issue Oct 11, 2017 · 1 comment

Comments

Projects
None yet
3 participants
@brandonkrull

brandonkrull commented Oct 11, 2017

A majority of times when collaborating on open source projects, you will not just push changes directly to the master branch, but rather to a separately named branch, and then create a pull request. Currently, this lesson contains no information about branching. The lesson could benefit from the idea of "branches" and how these can be used locally for trying new types experiments in your every day life in addition to collaborative environments.

@asadaqain

This comment has been minimized.

asadaqain commented May 8, 2018

I want to add that it should be in-scope as some users may not reach open source project level although user may be working alone / with colleges. Its best they learn how to do branching from the start, atleast locally.

So suggestion below may be applicable to "Tracking Changes" or "Collaborating" lessons or even possible new lesson of "Best Practices" or "Branching 101" (which could include Naming branches, working locally, merging, remote branches etc)

When I read branching may be too advanced topic ref: guide.md, it made me question it. SWC does have lessons such as "Exploring History" of checking out git commits and not losing HEADs (which may take them to rebasing)! To me that seems far more complex than branching, which can save you lots of headaches and it is a best practice!

Scenario

Problem: User clones a repo, does work. Discovers the path they were on is wrong or no longer needed! What should the user do?

Possible Solutions:

  1. User could checkout out from the remote and re-commit but that just messes up the log.

  2. cd .. nuke the project directory and clone it again. This may work in some cases but its not practical.

  3. One should be working is a local branch! (Proper Solution)

    (A lesson would go in detail of explainations)

    * $> git clone / git pull origin master
    * $ master> git checkout -b "To-be-abandoned" 
    * $ To-be-abandoned> Create files
    * $ To-be-abandoned> git adds and commits 
    * $ To-be-abandoned> Create more files. Oh! No longer 
    need to work on this!
    
    Life Saving Steps
    * $ To-be-abandoned> git add + git commit -m "Do not need it anymore" 
    * $ To-be-abandoned> git checkout master
    * $ master> git branch -d To-be-abandoned (delete the branch)
    * All is well
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment