I am pretty new to the world of Git and I apologised in advance if this thread of mine belongs in the wrong place. So far I have been reading up tutorials here and there, understanding the basics but I am getting myself stumped up in several areas. It may sounds really stupid, still I really hope someone can direct me…
So basically, I have created 2 branches, master and develop, both using the command - git branch
I am trying to create a new branch by having it to branch off from develop. Firstly, do I need to be on the develop branch itself before I can run this command - git checkout -b newBranch develop?
Pertaining to Qns1, how is the command different from this command - git checkout -b newBranch?
When do I use git branch --set-upstream command? Correct me if I am wrong, but from the article that I read, this is used when the user wanted to track it or if there are some problems in which when the user has already git push a particular branch and it is not able to read that branch in the git pull process
Though in my current repo, I have yet to experience such issue, I was wondering if my procedure is right:
git branch develop >> git checkout develop >> git add / git commit for any new files >> git push >> git checkout master >> git merge develop >> git push
Cause I realised that the develop branch is also being tracked…
Is there any good visualization softwares that can displays the branches in a more graphical manner? Tried using git log -pretty / gitk / gitg, can somewhat understand it but at times it is also confusing if I am looking in a large project with alot of commits etc…
[QUOTE=purga;24520]Have you tried Smart Git/Hg ? It has a more intuitive GUI and should help you get out of the maze.[/QUOTE]
Hi purga, thanks for getting back to me. As to your question, I did not tried out SmartGit/Hg as all along I am using either gitk or gitg for visualization.
Probably due to these 2 tools I have used, I thought that it will be easier for me to list down my doubts here (especially for question 1 and 2, plus a little bit on question 3) so as to get the confirmation of ‘theories’ I have conjured in my mind right
I will try out the visualization software that you have mentioned at home to see if it can help me grasp a better understanding
Git via the command line have never seized to confuse me. I went with SourceTree and haven’t looked back. It would make the route of how to branch off of branches obvious; as opposed to the same operation via a command line.
I am trying to create a new branch by having it to branch off from develop. Firstly, do I need to be on the develop branch itself before I can run this command - git checkout -b newBranch develop?
[/QUOTE]
Nope, when you specify the branch (develop) you can be on any branch as long as develop is found when you do ‘git branch’
[QUOTE=xenas;24489]
2. Pertaining to Qns1, how is the command different from this command - git checkout -b newBranch?
[/QUOTE]
That would do the same only if you are currently on the develop branch. It just branches from the currently selected branch.
[QUOTE=xenas;24489]
3. When do I use git branch --set-upstream command? Correct me if I am wrong, but from the article that I read, this is used when the user wanted to track it or if there are some problems in which when the user has already git push a particular branch and it is not able to read that branch in the git pull process
Though in my current repo, I have yet to experience such issue, I was wondering if my procedure is right:
git branch develop >> git checkout develop >> git add / git commit for any new files >> git push >> git checkout master >> git merge develop >> git push
Cause I realised that the develop branch is also being tracked…
[/QUOTE]
I’ve found this model to work the best for me. It might seem confusing to start with but it really works great after you get comfortable with it.
[QUOTE=xenas;24489]
4. Is there any good visualization softwares that can displays the branches in a more graphical manner? Tried using git log -pretty / gitk / gitg, can somewhat understand it but at times it is also confusing if I am looking in a large project with alot of commits etc…
Many thanks in advance[/QUOTE]
I don’t use graphical interfaces for this kind of thing but I get some kind of graph on my gitlab server that looks alright…
But Source Tree seems to fill your need for that.
I actually got a good question pertaining to git were using it for version control for a few unity games, a lot of our games use similar features so we have been deriving most new projects from old ones so we can use the features of the old project that we already made.
Right now I’m just forking and doing a clone with --depth=1 to clone so I don’t have to download the whole history, than just delete a lot of files that are only needed for the old project on the new fork.
Is there anyway to have the history on the new fork, only go back to the commit where I delete all the unneeded files from previous projects?