![]() ![]() Sorry ahead of time, I did this on mobile. You'll always have questions at work, or your coworkers might need your help in the future, so it's not time wasted asking for help now Much better than being 6 months into a job and not knowing still! Also, asking for help and being friendly can help you build relationships with your coworkers. Take advantage of being "new" to ask your questions. Everyone has been in that position at some point trying to understand a concept or new technology. Better to ask now than make a mistake later down the line. But if your coworkers are nice to you, take the opportunity to ask for help and ask questions, even if you think it'll be dumb or if you feel dumb. Sorry you're in the learning curve right now, it's not pleasant. Then it started clicking for me and i was alright. On top of doing my own reading and tutorials. I had to ask for a few explanations and sit down with someone to literally draw things out for me before i was able to get it. This gets me through 95% of my git work at my last 3 jobs. Repeat git add, git commit, git push, until your pull request gets approved.įin. ![]() Git sometimes gives a prompt to set an upstream branch, run that full command if prompted. 'git push' - this will send your changes to the cloud. 'git commit -m "add ability to load data to database"' - this will add your changes to your local git. This will prepare your edits to be committed to master. Once you have finished making / editing files - 'git add my_path_to_file'. 'git checkout my-colleagues-branch' - checks out an existing branch. 'git checkout -b my-new-feature' - makes a new branch (that's the -b) for your new feature. This will help prevent merge conflicts when it comes time to merge your dev branch to master. Git branch - a harmless way to check what branch you're on (normally either master or your development branch for a new feature)īefore you make a new feature, do 'git checkout master (or main is also becoming popular)' then 'git pull'. So, in practice, you probably won't have to use -set-upstream-to very often.Git status - pretty harmless way to check which files have been edited. ![]() Note that if you create or checkout master locally, Git typically would create origin/master as the default tracking branch behind the scenes. So, keeping in mind that origin/master is the actual branch which tracks the true remote master branch, we can tell Git to use origin/master as the tracking branch via: # from local master branch Origin/master | local tracking branch for master which mirrors the remote version Origin master | the master branch on the remote (as in the git pull command) Here is a brief summary: master | the master branch (either local or remote) Then, it does a merge into your local master branch using origin/master. The first step, git fetch origin, updates the local tracking branch origin/master with the latest changes, such that it mirrors the true master branch on the remote. Whenever you sync with the remote master branch, locally you are actually using origin/master.ĭoing git pull origin master is actually identical to this (assuming you are using the merge strategy by default): git fetch origin It exists mainly to serve as a proxy for the true remote master branch. This is a local branch, which exists on your local repo. ![]() Now, for the confusion, there is a third branch called origin/master. Similarly, there is also a branch called master which exists on the remote. The local branch master, which exists only in your local Git repo, is in what you do most of your actual development work. And you should have confusion, because it's confusing. You seem to have some confusion about references in the basic Git commands. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |