in Git by
Q:
What are the steps of git remote workflow?

▼ Show 1 Answer

0 votes
by

For example using GitHub as a remote repository

On the GitHub set up your remote GitHub repository

Then do a git's clone using 'git clone' command to create a new repository on our local system.

Now in the local working directory we do changes(either adding/editing files etc)

Then we're going to 'stage' our changes using the "git add" command

Then commit your changes that are in the staging area using the 'git commit -m <your custom message here>'

Setup a remote repository(origin) using command 'git remote add origin [email protected]:User/UserRepo.git' (you can change it later using command 'git remote set-url origin [email protected]:User/UserRepo.git')

Once we are ready to collaborate with others on the main repository, we'll push our changes up to our remote repository on GitHub(or the hosted remote repository) using command 'git push -u origin master'; here -u is upstream(use it only for first push command just once), origin is remote name and master is the branch's name.

One everyone else had pushed their changes to the remote repository,then we'll do a pull from remote repository to our local git repository using 'git pull' or 'git pull <remote-name> <branch-name>' command

Later on whenever doing new working the local repo; do 'git pull' and then start new work.

GIT
Learn More with Madanswer

Related questions

+1 vote
asked Jul 25, 2019 in Git by SakshiSharma
...